Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-10-2013, 03:54 PM
macropod's Avatar
macropod macropod is offline Message Box on Close Windows 7 64bit Message Box on Close Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,526
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You would probably do better to implement this via a DocumentBeforeClose macro, coded along the lines of:
Code:
Private Sub wdApp_DocumentBeforeClose(ByVal Doc As Document, Cancel As Boolean)
Const StrNm As String = "Home_Attempt_1_Date"
If Doc.FormFields(StrNm).Result = "N/A" Then _
  If MsgBox(StrNm & " is N/A." & vbCr & "Continue closing?", vbYesNo) = vbNo Then _
    Cancel = True
End Sub
For implementation instructions, see: http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm
Note also how much simpler the code can be made (even if you don't use this event)

Alternatively, see: http://word.mvps.org/faqs/macrosvba/...eforeClose.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Message Box on Close Close 'downloads' window with VBA CatMan Excel Programming 6 12-14-2012 01:34 PM
EXCEL tries to close a file userman Excel 2 05-31-2012 03:15 AM
Message Box on Close Message replys are shown at the bottom of the message, how can I get them to the top Gardy Outlook 3 05-23-2012 01:20 AM
Prompt when close the document ubns Word 15 04-29-2012 10:07 PM
Is there an exit on close ? mhdadmh Word 0 10-12-2006 04:28 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:01 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft