Importing an Excel file

C

Chris Gorham

Hi,

I'm trying to automate importing an excel template file in to an Access table.
I'm using DoCmd.TransferSpreadsheet and it works fine.

Only problem is that you have to state the full path of the excel file to be
imported.
I'm using an input box for the user to type this path in - but this is a bit
clunky.
Can someone tell me how to bring up the file import menu to allow the user
to select which file he wants to import more easily.

I can acheive this as well, but the user then has to go through the Access
"get external data" menu system - which I don't want to do

any help appreciated....Rgds Chris
 
L

Line Riendeau

Hi,

Here is the routin I use:

Dimm appAc = CreateObject("Access.application")
appAc.Visible = False
accAc.OpenCurrentDatabase (d:\abc\efg.mdb)
accAc.DoCmd.Runmacro("nom de la macro access")
appAc.CloseCurrentDatabase
 
J

John Ransom

I would suggest using the common dialog control to provide a user friendly
way to retrieve the desired filename
 
J

John Nurick

See http://www.mvps.org/access/api/api0001.htm

Hi,

I'm trying to automate importing an excel template file in to an Access table.
I'm using DoCmd.TransferSpreadsheet and it works fine.

Only problem is that you have to state the full path of the excel file to be
imported.
I'm using an input box for the user to type this path in - but this is a bit
clunky.
Can someone tell me how to bring up the file import menu to allow the user
to select which file he wants to import more easily.

I can acheive this as well, but the user then has to go through the Access
"get external data" menu system - which I don't want to do

any help appreciated....Rgds Chris
 

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