Error when using the BeforeSave event

D

Daniel

Hello,
I am testing the BeforeSave event in a very simple way and I got an error.
Here is the code:
Public Sub Project_BeforeSave(ByVal pj As MSProject.Project)
MsgBox pj.Name
End Sub

If I click on the save menu, I get the message, then I click on close and on
exit and everything is fine.
But if I click directly on close (some users can do that!), I get the close
dialogue box, then I keep “close†checked and click save. Then, I get the
message:
An unexpected error occurred with the method.
Looking at it on debug, it seems that the pj object exists, but all the
properties got the values: “An unexpected error etc.â€
It is like if the project has been closed before executing the macro! So
what’s wrong?
 

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