views:

32

answers:

1

I'm writing add-ins for Microsoft Project. Some of my toolbar buttons are only valid when a Project file is open, and I want to enable/disable them dynamically. Typically I'd watch for files to be opened or closed, then check the count of the open files. However, MS Project's API only has an Application.ProjectBeforeClose Event, and not a ProjectAfterClose event. The ProjectBeforeClose event fires before the user is prompted to save any changes, at which point they can cancel the close, and no additional event fires.

There's also WindowActivate and WindowDeactivate events, but the Deactivate only fires when switching to a different window, not on close.

Has anyone found an elegant solution to simulate the ProjectAfterClose event? Or more specifically, to enable/disable functionality based on whether or not a project file is open?

Thanks, Thomas

A: 

I had the same problem. A not-so-wonderful approach is to use a timer that checks to see if any projects are open...

Colby Africa