G
Guest
I am trying to open an excel file from Access but the code below stops at line
Workbooks.Open Filename:=impdir & strFile
I have checked that impdir & strFile is building the correct string.
Access is telling me object reuqired. What have I overlooked?
Sub test()
Dim strFile As String, impdir As String
impdir = CurrentProject.Path & "\Import\"
strFile = (Dir(impdir & "*.xls"))
If Len(strFile) > 0 Then
Do While Len(strFile) > 0
Workbooks.Open Filename:=impdir & strFile
Call AddApostrophes
' Range("A1").Select
ActiveWorkbook.Save
ActiveWindow.Close
strFile = Dir
Loop
Else
End
End If
End Sub
Bruce
Workbooks.Open Filename:=impdir & strFile
I have checked that impdir & strFile is building the correct string.
Access is telling me object reuqired. What have I overlooked?
Sub test()
Dim strFile As String, impdir As String
impdir = CurrentProject.Path & "\Import\"
strFile = (Dir(impdir & "*.xls"))
If Len(strFile) > 0 Then
Do While Len(strFile) > 0
Workbooks.Open Filename:=impdir & strFile
Call AddApostrophes
' Range("A1").Select
ActiveWorkbook.Save
ActiveWindow.Close
strFile = Dir
Loop
Else
End
End If
End Sub
Bruce