Import Excel File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have some code that ran well in Excel to open a dialog box to ask for a
file name. I want to do the same thing to import an excel file into an Access
table. When I tried to run it in Access, I keep getting a message that a
method or data member is not found. It keeps stopping on GetOpenFilename.
Is there an Access equivalent to this?
I changed the filter to look for excel files, but that didn’t work either.
Here is the code.

Dim fName As Variant
ChDir "C:\Documents and Settings\DSimmons\My Documents\Michal"
fName = Application.GetOpenFilename(FileFilter:="Text Files (*.txt),*.txt")
If fName <> False Then
workbooks.OpenText Filename:=fName
End If

Thanks
 
Back
Top