VBA Debug Part 1

In this video I talk about VBA Debug aspects like setting breakpoints, viewing the current state of variables, and stepping through code.

…as well as:

Set breakpoints to stop program execution.
Test variables in the immediate window.
Monitor variable values in the Locals window.

Here is the video:

Private Sub btnValidate_Click()
    If IsEmailAddress(Me.txtEmail) Then
        MsgBox "This is a valid email address"
    Else
        MsgBox "Please enter a valid email address"
    End If
End Sub


Function IsEmailAddress(email_address) As Boolean
    
    'is there the presence of an @ sign?
    If InStr(1, email_address, "@") Then
        'is there a ".com"?
        If InStr(1, email_address, ".com") Then
            IsEmailAddress = True
        Else
            IsEmailAddress = False
        End If
    Else
        IsEmailAddress = False
    End If
    
    
End Function

<< VBA Variable Scope | VBA Debug Part 2 >>

Click here for VBA debugging related posts.


Leave a Reply