我无法将excel文件导入Microsoft Access
当我转到外部数据选项卡并选择Excel选项时,我可以从那里导出数据,但无法导入数据。 我得到的这张表格无法导入我无法将excel文件导入Microsoft Access,excel,ms-access,Excel,Ms Access,当我转到外部数据选项卡并选择Excel选项时,我可以从那里导出数据,但无法导入数据。 我得到的这张表格无法导入 只需转到“外部数据”选项卡,然后在左上角有一个按钮“新建数据源”。单击此按钮,然后选择“从文件”,然后您可以选择“Excel”您可以使用VBA从多个Excel文件执行相同或更多操作,如将数据导入Access Sub TryThis() Dim strPathFile As String, strFile As String, strPath As String Dim strTable
只需转到“外部数据”选项卡,然后在左上角有一个按钮“新建数据源”。单击此按钮,然后选择“从文件”,然后您可以选择“Excel”您可以使用VBA从多个Excel文件执行相同或更多操作,如将数据导入Access
Sub TryThis()
Dim strPathFile As String, strFile As String, strPath As String
Dim strTable As String
Dim blnHasFieldNames As Boolean
' Change this next line to True if the first row in EXCEL worksheet
' has field names
blnHasFieldNames = False
' Replace C:\Documents\ with the real path to the folder that
' contains the EXCEL files
strPath = "C:\Documents\"
' Replace tablename with the real name of the table into which
' the data are to be imported
strTable = "tablename"
strFile = Dir(strPath & "*.xls")
Do While Len(strFile) > 0
strPathFile = strPath & strFile
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames
' Uncomment out the next code step if you want to delete the
' EXCEL file after it's been imported
' Kill strPathFile
strFile = Dir()
Loop
End Sub
你真棒!