Article ID: 184174
Article Last Modified on 10/10/2006
Dim S As Stringreplace it with the following line of code:
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: 8.00 8.0 vba vbe XL98
Keywords: kbbug kbconversion kbdtacode kbnofix kbprogramming KB184174