VBA - Close Do Not Save

S

ScoobyDon

BRIEF EXPLANATION:

I have 10 project managers who need several macros, where this number of
users is very small in comparison to total number of Project Managers in our
Enterprise environment. So, to limit the access to these procedures it was
decided to place them in a .mpp file saved in a network folder instead of in
the Enterprise Global.

So a single macro was written and given to these 10 project managers. The
single procedure will open (read-only) and hide this .mpp file. The .mpp file
has an on open event to build a menu which contained all the procedures they
needed. So when they went to use a macro in the new menu it was calling the
procedure from the hidden .mpp file.

These 10 PMs use this method with great success, they get what they need, if
they need something changed in a procedure I do it one location and everyone
gets it. Without having to place these modules in the Enterprise Global.

PROBLEM:

So the hidden .mpp file is never closed by the user. When they exit the
application the hidden .mpp would close without a prompt to save, because
they never made any changes to it. However, it seems that if it is left open
for an extended period of time, when they exit the application they get a
prompt to save the hidden .mpp file.

I tried a number of things:
BeforeClose: ThisProject.Saved = True, ActiveProject.Saved = True... Write
to the Saved property (apparently MS Project Saved Property is read-only)

BeforeClose: FileCloseEx pjDoNotSave (Won't work since your closing it
already)

ApplicationBeforeClose:
Unhide / Activate the .mpp window then
FileCloseEx pjDoNotSave (Didn't work either, thought for sure this one would)

When closing a project file, how do I avoid / supress the save prompt?
 
J

Jan De Messemaeker

Hi,

The "certain period of time" makes a bell ring.
Un tools, Options, Save, don't they have the auto-save on?
so start the macro with OptionsSave Automaticsave:=false;
I think hat will solve the issue.

Greetings,

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
S

ScoobyDon

Thanks for the reply...

It's not the autosave feature, all of the PMs in question don't use this
feature.

It's just the fact that they've had the project open for what ever amount of
time, without ever touching it or making changes to it, so when the project
is closed it brings up the save prompt.

I am looking for a way to write to the Saved property (which can't be done),
or some other method to trick the project into thinking it was already saved
so the prompt does not come up when the project is closed. My goal is keep
this project invisible to the users, so they never know it's there.

I've developed a work-around for the time being, by creating a class module
capturing application events. Using the ProjectBeforeClose app event so that
everytime a project the PM is working on is closed is it closes the hidden
..mpp using FileCloseEx pjDoNotSave, then re-opens (read-only) and hides the
procedure containing .mpp.

I did this thinking, well, they usually exit the application (which would
then close the hidden .mpp and bring up the save prompt) right after they
close and check-in all their projects. So use that event to close and re-open
the hidden .mpp (re-opening just in case they weren't done or working in
several projects). So on their final close of a project before exiting the
application it would be like the hidden .mpp was just open so project would
not recognize a need to save anything....

If that makes any sense :)
 

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