How To Make An InputBox In VBA

The input box is a great way to retrieve and process input
from your user.

In the following example we’ll control program flow based on the
user’s input in the inputbox.

Your user will enter a text value and we will evaluate their answer
and send them in the right direction.

Sub InputboxVBA()
    Dim strAnswer As String
    
    strAnswer = InputBox("What is the password?", "Enter Password")
    
    Select Case strAnswer
        
        Case "P@ssword"
            MsgBox "Correct!  You can now use the program."
            
        Case Else
            
            MsgBox "Your password entry was incorrect"
            
    End Select
End Sub

 

Let me know if you have any questions on how to make thisĀ  InputBox in VBA


Comments are closed.