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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make Excel code execute after TransferSpreadsheet

Status
Not open for further replies.

shauntwo

Technical User
Jul 9, 2002
64
0
0
US
Hi,

I have a form in Access that transfers a query using the DoCmd.TransferSpreadsheet method to a predefined Excel spreadsheet. After the DoCmd, I then define an Excel application object to open the workbook automatically that received the transfer. Within the workbook, I have an Auto_Open macro that I want to run whenever the workbook opens. Problem is, the Excel macro doesn't automatically execute; I'm guessing that the dailog box that would otherwise come up during the opening of a workbook, that asks users whether or not they want to enable macros, is automatically choosing to disable my macro. What can I do to get around this?

Thanks for your help.

Shaun
 
Hi Shaun,

As far as i'm aware Auto_Open macros do not run automatically if the files are opened by VB code.

I had a similar problem using VB with Excel to open another spreadsheet which had an Auto_Open macro. This also didn't Auto run.

To get around this i had to use the RunAutoMacros command immediately after opening the file.

Workbooks.Open ("c:\Temp\Test.xls")
ActiveWorkbook.RunAutoMacros xlAutoOpen

Maybe you need to do something similar in your Excel Application Object.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top