MACRO LIBRARY

Lesson 1.6 - InputBox function

Free public access. No account or subscription required.

Files

Lesson 1.6 - InputBox function

Code

Dim retval As Integer
Dim blnCorrect As Boolean
Dim strName As String
    
Sub main()
    blnCorrect = False
    While blnCorrect = False
        strName = InputBox("Please enter your name.")
        If strName = "" Then End
        retval = MsgBox("You entered: " & strName & vbCrLf & "Is this correct?", vbYesNo)
        If retval = vbYes Then blnCorrect = True
    Wend
    MsgBox "Name entry complete."
End Sub