Launch a macro at the opening of Project

S

S. Dekooninck

Hi,

I would launch a macro ("MyMacro") whose purpose is to initialize some
variables like the application and to make some macros (like
Application.ProjectBeforeTaskChange) efficient.
But I don't find a macro like Application.Open where I could put "Call
MyMacro".
I tried to put it in Project.Open but it seems to not work.

Do you have any idea to help me ? I often forget to launch MyMacro at
each launch of Project.

Thanks a lot
Sebastien
 
J

Jan De Messemaeker

Hello,

Inthe Project Explorer, Find VBAProject (the nameof the project), thereunder
Open MS project Objects, then double-Click ThisProject and paste the
following:
Private Sub Project_Open(ByVal pj As Project)

End Sub

That should put you on your way.
HTH
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
Project Management Consultancy
Prom+ade BVBA
32-495-300 620
 
A

Alex

Hi Jan,
Thanks for this information.
When I run the Micro from VBA it works just fine. But
when I go to open the specifed Project file, I do not get
the same prompt to run the macro as I do in VBA. Any
ideas?
Thanks (this site is great)!
Alex
 
A

Alex

Thanks Jan.
Duh - I did not insert the macro instruction between the
two lines of code you gave me. Now it works like a charm.!
 
J

Jack D.

S. Dekooninck said:
Hello,

I would have some information about the launch of the macros.
I know how to launch a macro for a specific project, but my question
is at the launch of the application MS Project.
Do I need to copy my macro in each project (using event Project_open)
or does it exist a simpler way to make the initialization ?

Thanks
Sébastien

Put the project open macro in the Global.mpt file. That file is opened
whenever project is run, so it will run whenever the application is opened.

--
Please try to keep replies in this group. I do check e-mail, but only
infrequently. For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP


+++++++++++++++++++
 

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

Top