M
Microsoft
Word 2000
It seems like I should be able to figure this out, but I just can't get
it working. I have the following code that displays a message box with
Yes and No buttons. No matter which button I click in the message box,
the code always takes the same branch of the IF statement. Can someone
tell me what I'm doing wrong?
Sub TestMessageBox()
Dim Response As Boolean
' Sets the message box elements.
mbMessage = "Did the document print successfully?"
mbStyle = vbQuestion + vbYesNo + vbDefaultButton2
mbTitle = "Document Printed?"
' Displays the message box.
Response = MsgBox(mbMessage, mbStyle, mbTitle)
' Branches based on the message box response.
If Response = vbYes Then
MsgBox "Yes"
Else
MsgBox "No"
End If
End Sub
--Tom
It seems like I should be able to figure this out, but I just can't get
it working. I have the following code that displays a message box with
Yes and No buttons. No matter which button I click in the message box,
the code always takes the same branch of the IF statement. Can someone
tell me what I'm doing wrong?
Sub TestMessageBox()
Dim Response As Boolean
' Sets the message box elements.
mbMessage = "Did the document print successfully?"
mbStyle = vbQuestion + vbYesNo + vbDefaultButton2
mbTitle = "Document Printed?"
' Displays the message box.
Response = MsgBox(mbMessage, mbStyle, mbTitle)
' Branches based on the message box response.
If Response = vbYes Then
MsgBox "Yes"
Else
MsgBox "No"
End If
End Sub
--Tom