Pages

Thursday, December 29, 2011

Import Excel sheet or Range into Access Table

If you want to import Excel Sheet into Access Table.

Here is the code-


Sub import_excel_file()
Dim sample_table As String
sample_table = "temp_table_name"
' import a specific range from a worksheet
DoCmd.TransferSpreadsheet acImport, , sample_table, "C:\Users\ashishkoul\Desktop\learn\sales_detail.xlsx", True, "sales_detail$a1:d10"
' import wholeworksheet
DoCmd.TransferSpreadsheet acImport, , "new_sample_table", "C:\Users\ashishkoul\Desktop\learn\sales_detail.xlsx", True, "sales_detail"
End Sub

Download Access Database

No comments:

Post a Comment