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

4

1 回答 1

1

我有同样的问题。一个不太好的方法是使用一个计时器来检查是否有任何项目处于打开状态......

于 2010-02-01T22:20:38.143 回答