Import Excel File

M

melric

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top