Article ID: 157107
Article Last Modified on 11/23/2006
Dim S As Stringreplace it with the following line:
Dim S As Variant
Sub Macro()
Dim S As String
' Prompt for the user's name and place the value in string
' variable S.
S = Application.InputBox("Enter Your Name:")
' If user clicks Cancel in the Inputbox, S is False. If S is
' False, exit the procedure.
If S = False Then
Exit Sub
Else
MsgBox S
End If
End Sub
The previous example fails with a type mismatch error at the following
line
If S = False Thenbecause the macro compares a string variable to the Boolean value False.
Application.GetOpenFileName
Application.SaveAsFileName
Application.InputBox
Additional query words: XL97 8.00 8.0 vba vbe
Keywords: kbdtacode kberrmsg kbfaq kbprb kbprogramming KB157107