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 / October 2006

Tip: Looking for answers? Try searching our database.

DocumentBeforeSave event - ActiveDocument closing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mrb - 25 Sep 2006 10:58 GMT
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,
Signature

Andrew

Doug Robbins - Word MVP - 25 Sep 2006 19:17 GMT
See the article "A Pseudo DocumentBeforeClose Event" at:

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

Signature

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

>I am new to developing Word add-ins.  How can I determine whether an
> Word.ActiveDocument is closing during the DocumentBeforeSave event.
[quoted text clipped - 22 lines]
>
> Thanks,
mrb - 02 Oct 2006 09:16 GMT
Thanks for this information.
However I have found another COM addin (Hummingbird DM related) which i
believe is displaying a Save dialog box which prevents me from intercepting
the save event using this method. I think this is the main cause of the
problem.

Signature

Andrew Bewick

> See the article "A Pseudo DocumentBeforeClose Event" at:
>
[quoted text clipped - 26 lines]
> >
> > Thanks,
 
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.