 |
Richard M Level: Trainee
 Registered: 02-10-2005 Posts: 1
|
run code when closing document?
I am using the following code from another post to check a form fill in box upon close. If the textbox is null or empty I want a message saying so and then cancel the save operation. The code is not working. What am I missing?
Private Sub Document_Close()
Dim iChk
If ActiveDocument.Saved = False Then
iChk = MsgBox("do you want to save the changes to " & ThisDocument.Name & "?", vbYesNoCancel, "check if document changed")
Select Case iChk
Case 6
If IsNull(text1) Then
MsgBox ("you need to fill in the text1")
MsgBox "Cancel"
Exit Sub
End If
MsgBox "Yes"
Case 7
MsgBox "No"
Case 2
MsgBox "Cancel"
End Select
End If |
____________________________
Richard
|
|
02-10-2005 at 10:32 PM |
|
|
|
|
 |
 |