Group:  Microsoft Word ยป microsoft.public.word.vba.addins
Thread: Run addin code when a document is closed or minimised

Run addin code when a document is closed or minimised
"G Craven"<gnc[ at ]googlemailNOSPAM.com> 3/29/2007 10:27:15 AM
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
Re: Run addin code when a document is closed or minimised
"Perry" <drumper[ at ]gmail.com> 4/9/2007 9:38:54 PM
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



"G Craven" <gnc[ at ]googlemailNOSPAM.com> schreef in bericht
news:57c49e56b35c4b8ea4395af54da1805c[ at ]ureader.com...
[Quoted Text]
> 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

Re: Run addin code when a document is closed or minimised
"Perry" <drumper[ at ]gmail.com> 4/9/2007 10:02:17 PM
[Quoted Text]
> _DocumentSave()
change that into

_DocumentChange() event

Sorry for inconven

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE



"Perry" <drumper[ at ]gmail.com> schreef in bericht
news:DF96D610-9424-46B6-A878-872A8887B510[ at ]microsoft.com...
> 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
>
>
>
> "G Craven" <gnc[ at ]googlemailNOSPAM.com> schreef in bericht
> news:57c49e56b35c4b8ea4395af54da1805c[ at ]ureader.com...
>> 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
>

Home | Search | Terms | Imprint
Newsgroups Reader