How To Use A Variable In A VBA Message Box.

In this post I’m going to show you how to use a variable in a vba message box.

This is used commonly to notify the user that an entered item in a combo box is not in the list, also
per this post it’s to display the error number or the error description to the user when handling errors.

Here is how it goes:

Sub VBAMsgboxVariable()
    Dim strError As String
    Dim intError As Integer
    
    On Error GoTo errhandler
    
    intError = 1 / 0
    
Exit Sub
errhandler:
    
    strError = Err.Description
    
    MsgBox "Your error is: " & strError
      
End Sub

Let me know if you have any questions.

Offsite Related Information:

“Go Fund Me” Page


($5 suggested amount)

(…10% of your gift amount will go to charity)

Free! Subscribe To Our YouTube Channel!

Free MS Access VBA Programming Course

Facebooktwitterredditpinterestlinkedinmailby feather
Tags: