Inputbox Type 2 Get Some Text From The User

less than 1 minute read

InputBox Type 2 - get some text from the user

'==================================================================================================
' ## InputBox Example 2: (Type 2) - Inputbox to get some text from the user
'==================================================================================================
Sub InputBoxText()
    '// Vars
    Dim YourName As Variant

    '// Prompt for a name
    YourName = Application.InputBox _
        (Prompt:="What's your name?", Title:="Text only", Type:=2)

    '// Test if clicked cancel
    If YourName = False Then Exit Sub

    '// Output
    MsgBox "Your name is " & YourName
End Sub

Tags:

Categories:

Updated: