Group:  Microsoft Word ยป microsoft.public.word.vba.addins
Thread: DocumentBeforeSave event - ActiveDocument closing

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

DocumentBeforeSave event - ActiveDocument closing
mrb 25.09.2006 09:58:02
I am new to developing Word add-ins. How can I determine whether an
Word.ActiveDocument is closing during the DocumentBeforeSave event.
as the DocumentBeforeSave event appears to trigger before
DocumentBeforeClose Event.
I need to differentiate between these scenarios:

1) a user is closing a document (clicking 'X' button on window) and
selecting 'Yes' from 'Do you want to save....'. then closes document.
I want to add additional code in the DocumentBeforeSave event in this
instance.

2) a user is closing a document (clicking 'X' button on window) and
selecting 'No' from 'Do you want to save....' then closes Document.

3) a user is closing a document (clicking 'X' button on window) and
selecting 'cancel' from 'Do you want to save....' and Document does not
close.

and 2) simply clicking the File>Save button or any shortcut save keys.
Document does not close.

It looks as though the DocumentBeforeSave is triggered before the
DocumentBeforeClose event. Is there perhaps a way to change the order in
which these events are triggered in Word?

Thanks,
--
Andrew
Re: DocumentBeforeSave event - ActiveDocument closing
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 25.09.2006 18:17:18
See the article "A Pseudo DocumentBeforeClose Event" at:

http://www.word.mvps.org/FAQs/MacrosVBA/PseudoBeforeClose.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"mrb" <mrb[ at ]discussions.microsoft.com> wrote in message
news:A10EB3DB-EF42-4AF4-9DAE-2EB6D513F320[ at ]microsoft.com...
[Quoted Text]
>I am new to developing Word add-ins. How can I determine whether an
> Word.ActiveDocument is closing during the DocumentBeforeSave event.
> as the DocumentBeforeSave event appears to trigger before
> DocumentBeforeClose Event.
> I need to differentiate between these scenarios:
>
> 1) a user is closing a document (clicking 'X' button on window) and
> selecting 'Yes' from 'Do you want to save....'. then closes document.
> I want to add additional code in the DocumentBeforeSave event in this
> instance.
>
> 2) a user is closing a document (clicking 'X' button on window) and
> selecting 'No' from 'Do you want to save....' then closes Document.
>
> 3) a user is closing a document (clicking 'X' button on window) and
> selecting 'cancel' from 'Do you want to save....' and Document does not
> close.
>
> and 2) simply clicking the File>Save button or any shortcut save keys.
> Document does not close.
>
> It looks as though the DocumentBeforeSave is triggered before the
> DocumentBeforeClose event. Is there perhaps a way to change the order in
> which these events are triggered in Word?
>
> Thanks,
> --
> Andrew


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net