Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Excel Workbook when Access is opened

Status
Not open for further replies.

deevaetodin

Technical User
Jun 22, 2001
80
US
Is there a way to create a macro or enter code so that when an Access database is opened a specific Excel Workbook is also opened in excel.

Any help would be great.

Do you need to use the OpenHyperlink command?
 
Hi!

You should be able to use the following code:

Public Function OpenExcelWB

Shell("Excel " & YourPathAsAString, vbMinimizedNoFocus)

End Function

Then you can call this function from the autoexec macro using the RunCode action. I am not totally sure about the syntax of the first part of the Shell function, you may need a : after the Excel.

hth
Jeff Bridgham
 
I have tried to incorporate this, maybe I am entering the string wrong but it keeps giving me an expected "=" error at the end of line 2.

Could you give me an example of YourPathAsAstring.

Thanks for all your help.
 
Hi!

Well I would try putting an = in there.

Shell("Excel = " & Path, etc.)

The path is just where the excel file is at, for example:

Path = "C:\MyExcelFiles\Budget.xls"

hth
Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top