rollingzep
Board Regular
- Joined
- Nov 18, 2013
- Messages
- 224
- Office Version
- 365
- Platform
- Windows
Hi,
<p>
I have an Access DB. I need to import two worksheets from a Workbook having 10-12 sheets.
I am using Access VBA. The code below opens the workbook and I am not sure how to select a specific worksheet.
I use the TransferSpreadsheet method. Can you suggest a solution?
I use the FileDialog since it is Access VBA.
<p>
I have an Access DB. I need to import two worksheets from a Workbook having 10-12 sheets.
I am using Access VBA. The code below opens the workbook and I am not sure how to select a specific worksheet.
I use the TransferSpreadsheet method. Can you suggest a solution?
I use the FileDialog since it is Access VBA.
VBA Code:
Private Sub Import_FDT_Click()
Dim SelectedFile As String
Dim FilePicker As FileDialog
Dim SQLdelete As String
Set FilePicker = Application.FileDialog(msoFileDialogFilePicker)
FilePicker.AllowMultiSelect = False
FilePicker.Filters.Add "Excel", "*.xls*", 1
FilePicker.InitialFileName = "J:\Product Control\CFF\CFT & FDT Uploading Template\"
FilePicker.Title = "Please Select the Excel Data..."
FilePicker.Show
If FilePicker.SelectedItems.Count <> 0 Then
SelectedFile = FilePicker.SelectedItems(1)
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "FS_FDT_Import", SelectedFile, True
MsgBox ("The data has been successfully loaded")
End If
End Sub