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.
How To Parse A Flat File In Excel VBA
In another post I demonstrated how to access a file on your computer using the MS Office Library. Here it is if you don’t know what I’m talking about. In this post, I am going to show you how to access the file and load it into your spreadsheet. I will do the same thing […]
How To Generate A XML File With Access VBA
XML is used to structure your data. You can send a CSV file to another person, but using XML, you can structure your data in a more elegant format, and get very specific about your fields, and what data is contained within your tags (your field names). This is different than a basic CSV file […]
How To Search A String With The VBA Instr Function
The VBA Instr Function is very useful for searching a string for a particular piece of text. If for example you want to loop a column or a field in a table of multiple rows, and want to identify prize rows that are 81.51, you would write something like this: Sub VBAInstrFunction() Dim dblTemp As […]
How To Do A VBA CSV Import For One To Multiple Files
So you want to be able to import your csv for 1 to multiple files. Here’s how you do it. 1. up a form with a button. 2. After you click the button, you will get a File Dialog Box that will show you the csv files to choose from: Here is the code behind […]