Sub Test()
Dim x
x = Application.InputBox("你好")
'避免当用户手动输入"False"造成程序错误判断
If (TypeName(x) = "String" And x = "False") Then
Range("A1") = "'" & x '强制文本,因为Excel中输入False会自动FALSE
ElseIf x = False Then
MsgBox "点击了取消"
Exit Sub
ElseIf Len(x) = 0 Then
MsgBox "未输入内容"
Else
Range("A1") = x
End If
End Sub
--------------------------------------
Sub Test1()
x = Application.InputBox("你好")
If x = False And TypeName(x) = "Boolean" Then
Exit Sub
ElseIf x = "" Then
MsgBox "未输入内容"
Else
Range("a1") = x
End If
End Sub