Hi,
I want a macro to run automatically when I open a project file. How can I do that?
Thanks,
Deb
Hi,
I want a macro to run automatically when I open a project file. How can I do that?
Thanks,
Deb

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
You can create a macro named Auto_Open in a standard module, or an event procedure called Project_Open in the ThisProject module.
If you do this in a specific project, the code will run automatically when you open that project.
If you store it in Global.mpt, the code will run whenever you open a project.
Thank you . This helped, but I now have another issue. I am unable to create a macro in my resource pool file. When I attempt to record a macro and store it in "This Project" I get an error after clicking on OK in the Record Macro dialog box. The error is:
************************************************** ************************************************** ***
"Macro" is not a valid name.
A macro name must begin with a letter and can contain letters, numbers, and the underscore character. It cannot contain spaces or be a word that Project reserves as a keyword. A macro name aslo cannot be longer than 128 characters in length.
************************************************** ************************************************** ***
I get this error no matter what name I try.
I also tried to create it with the VB editor, but the This Project object does not exist to add a module to. Only "Project Global (Global.MPT)" is displayed.
I don't want to add the macro to the global template, I only want it to run in this project. Any ideas why I can't add it to a resource pool file? Is this not supported for some reason?