Question about Auto_Open

DrQuality

New member
Local time
Today, 07:20
Joined
Jul 16, 2002
Messages
6
Hello,

I was wondering if I execute the following code:
Dim oApp, oWB As Object
' open Excel
Set oApp = CreateObject("Excel.Application")
' load a spreadsheet file
Set oWB = oApp.Workbooks.Open("W:\Working Directories\Mike\RegressThis.xls")

whether the startup macro in RegressThis.xls will run?? See, I have Access exporting a table to Excel, then opening excel in the above fashion, then I *thought* it would run RegressThis.xls' startup macro, but it doesn't seem to be doing it!!

Thank you!!
 
Here's the code I use for Access 97 and Excel 97...

Dim XL As Object
Set XL = CreateObject("Excel.Application")
With XL.Application
.Visible = False
.Workbooks.Open "C:\My Documents\Excel\Databases\Test.xls"
.Run "YourMacroNameHere"
.Quit
End With
Set XL = Nothing

This is only used to run a macro called "YourMacroNameHere", that is why the spreadsheet is invisible, you may want to set .Visible = True if needed.

HTH
 

Users who are viewing this thread

Back
Top Bottom