Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Run addin code when a document is closed or minimised

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
G Craven - 29 Mar 2007 11:27 GMT
Hello everyone.
I am using Word 2007 with a VS2005 VB addin which creates a Corporate Tab on
the Word Ribbon. Several of the controls on this tab need to be disabled
when there are no documents open or they are minimised. Word starts with no
documents open, and the controls in question run the getEnabled callback,
this all works fine. When the user opens a document from this tab,
InvalidateContol is used to refresh the controls in question and enables
them.
So far so good, but the next line is the problem.
When a user closes or minimses a document, I need the InvalidateControl to
run again. Help!!

I am trying to put all of the code in the addin, not in an auto_macro in
Word, as this would require the normal.dotx and the addin to be bundled
together when updates are run.

The question is, how can the addin be aware of what a document is doing?

Thanks alot. Hopefully
Perry - 09 Apr 2007 22:38 GMT
Try to use the _DocumentSave() delegate in yr eventhandling object.

If coded properly, this should fire when you minimize the activedocument to
bring up another ...
This event will also fire when you change windows within the active MS Word
session, as long
as the scope of yr eventhandling object allows this.

It won't fire if you minimize MS Word, though ...

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE

> Hello everyone.
> I am using Word 2007 with a VS2005 VB addin which creates a Corporate Tab
[quoted text clipped - 17 lines]
>
> Thanks alot. Hopefully
Perry - 09 Apr 2007 23:02 GMT
> _DocumentSave()
change that into

_DocumentChange() event

Sorry for inconven

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE

> Try to use the _DocumentSave() delegate in yr eventhandling object.
>
[quoted text clipped - 36 lines]
>>
>> Thanks alot. Hopefully
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.