VBA help needed

D

Debbiedo

I have the following code in my MS Word 2003 protected form to
display a message box when saving but how can I modify it to display
when
exiting (ie, hitting the X in the corner or Exit from the File menu)?

Public Sub FileSave()


Dim Answer As Integer
Dim Msg As String
On Error Resume Next
Msg = "If Student ID is NOT filled out" & _
vbCr & "click Cancel and go back."
Answer = MsgBox(Msg, vbOKCancel)
If Answer = vbOK Then
ActiveDocument.Save
End If


End Sub


Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top