If... Then... ElseIf... Else Statements
Sub Creating_a_Document()
Dim lngButton As Long
Dim strMessage As String
strMessage = "Question."
lngButton = MsgBox(strMessage, vbYesNoCancel + vbQuestion, "Create New Document")
If lngButton = vbYes Then
Documents.Add Template:="C:\t.dot"
ElseIf lngButton = vbNo Then
Documents.Add
Else 'lngButton is vbCancel
End
End If
End Sub
Related examples in the same category