How to run auto-open macro in Excel 2007?



For years I've been using an Excel 2000 workbook (under Win XP)
containing several macros, one of which is auto-opened at launch. (It
performs necessary date checks). Security has been set so that before
the workbook opens I get a warning text box asking me if I want to
enable or disable macros.

I've just ported the workbook to Office 2007 in a new computer running
Win 7 Pro. With this system I find that when the workbook opens (in
compatibilty mode), the current worksheet and the warning bar about
macros appear simultaneously. I can accept or reject macro operation
as I wish, but even if I accept it the auto-open macro hasn't run. Any
ideas how to get round this? I'm in unfamiliar territory with no
previous experience of Win 7 and not much of Office 2007. Have I just
missed something simple?

I can't use self-signed certificates because the workbook will be used
on more than one computer.

TIA John



Dave Peterson

I don't use win7, but I've never experienced any problems with my auto_open or
workbook_open procedures that were written in xl97 to xl2003 when opened in

I allow macros to run and they fire successfully.

Maybe it's the macro itself????

Could you add a
msgbox "Running"
as the first line inside the code--just to see if the code actually starts???


Thanks Dave. Problem fixed. The auto-open macro does run as soon
once Macros are enabled. I was fooled by the worksheet appearing
before I could enable macros, the opposite of the sequence in xl2k.




Chip Pearson

Just as a side note, the Auto_Open procedure (indeed all the Auto
procedures) does not run if the workbook is opened via code. For

Dim WB As Workbook
Set WB = Workbooks.Open("C:\Test.xls")

The Auto_Open proc of C:\Test.xls will not be executed. You must call
it yourself if it needs to run:

WB.RunAutoMacros xlAutoOpen

Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
[email on web site]

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