Private Sub ExportExcelSheetToAccess(sSheetName As String, _
sExcelPath As String, sAccessTable As String, sAccessDBPath As String)
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(sExcelPath, True, False, "Excel 5.0")
Call db.Execute("Select * into [;database=" & sAccessDBPath & "]." & _
sAccessTable & " FROM [" & sSheetName & "$]")
MsgBox "Table exported successfully.", vbInformation, "Yams"
End Sub
Private Sub Command0_Click()
Set fd = FileDialog(msoFileDialogFilePicker)
With fd
.ButtonName = "打开"
.Title = "请浏览文件"
.Filters.Clear
.Filters.Add "*.xlsx", "*.xls"
.InitialView = msoFileDialogViewList
.AllowMultiSelect = False
If .Show = -1 Then
Me.路径 = CStr(.SelectedItems(1))
End If
End With