Hi Experts,
I'm trying to write a code to import the excel file into access. Here is the code..
Private Sub Command8_Click()
Dim strPathFile As Variant
Dim strFilter As String
Dim ahtAddFilterItem() As String
Dim ahtCommonFileOpenSave() As String
Dim lngFlags As Long
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.XLS")
strPathFile = ahtCommonFileOpenSave(InitialDir:="C:\Users\PZ8P95\Desktop\Excel testing\", _
Filter:=strFilter, OpenFile:=False, Flags:=lngFlags, _
DialogTitle:="Select the EXCEL file:") ---------------> In this line, I'm getting Compile error as Named arguements not allowed
If strPathFile = "" Then
MsgBox "No file was selected.", vbOK, "No Selection"
Exit Sub
End If
DoCmd.TransferSpreadsheet acImport, (strFilter \ "Excel file.xls"), _
Sheet1, strPathFile, False
End Sub
Please let me know what's the solution Please.
Many thanks!
Puppy
I'm trying to write a code to import the excel file into access. Here is the code..
Private Sub Command8_Click()
Dim strPathFile As Variant
Dim strFilter As String
Dim ahtAddFilterItem() As String
Dim ahtCommonFileOpenSave() As String
Dim lngFlags As Long
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.XLS")
strPathFile = ahtCommonFileOpenSave(InitialDir:="C:\Users\PZ8P95\Desktop\Excel testing\", _
Filter:=strFilter, OpenFile:=False, Flags:=lngFlags, _
DialogTitle:="Select the EXCEL file:") ---------------> In this line, I'm getting Compile error as Named arguements not allowed
If strPathFile = "" Then
MsgBox "No file was selected.", vbOK, "No Selection"
Exit Sub
End If
DoCmd.TransferSpreadsheet acImport, (strFilter \ "Excel file.xls"), _
Sheet1, strPathFile, False
End Sub
Please let me know what's the solution Please.
Many thanks!
Puppy