Open Excel file from Access?

hobbes

Registered User.
Local time
Today, 11:17
Joined
Feb 13, 2004
Messages
30
Is it possible to create a macro or VB code to open an Excel file? Ideally, a user will open the database and press a button which will open the Excel file (which has a macro attached to reformat it), and then import it into the database and run a query (all of which are connected to another macro). The problem is getting Access to open that file in the first place. Any suggestions?? Thank you!!!
Hobbes
 
Thank you for the link! I'm not sure if I was missing something or just didn't understand, but I don't think I found the solution to my problem there. I don't want to import a file from Excel (the database is set to do that already). I just need Access to open the file (which should open Excel automatically since the file is set to open with Excel). I have the macros written in Excel to reformat the spreadsheet before I import it, but as it stands now, the users have to open the file separately and the macro runs when the file opens. Then they have to go back to the Access database and press another button that will import it and run several queries before spitting out the information they are looking for. Ideally, I'd like to have the users open the database and press one button that will do everything for them instead of having to open the file separately. Any suggestions??? I'm more than willing to go back through the other discussion if you could just point me to the part that will just open the file. Thank you!!! :)
 
Try this

Hobbes,

Try this;
Make a command button on a form. Use this code when the button is clicked;
stAppName = "excel.exe c:\documents\yourfile.xls"

This opens yourfile.xls in Excel.

Hope it works for you.

gr.
Martijn
 
based on hobbes question i would like to ask the code for just printing the specific excel file after opening it. (pirnt active sheet)
thanks.
 

Users who are viewing this thread

Back
Top Bottom