vba-for-loop

What is the purpose of the Me keyword in Access VBA?

What does the Me keyword mean? “Me” refers to the Access form currently in focus. Instead of writing out the entire form reference, you can just use the keyword “Me” which is easier. Like: Me.txtbox = “I am a textbox on the form that currently has the focus.” or you can update a label’s caption […]

Continue Reading

How To Exit A VBA Loop

Hi, there are times when you need to exit a loop after a certain condition has been met. How do you exit function in VBA? In the following example, you are going to see how to exit a function in VBA: Sub StartNumbers() Dim intNumber As Integer intNumber = ExitTest ‘the number is going to […]

Continue Reading

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 […]

Continue Reading

How To Have Access Export A Table To An Excel XLSX In VBA

This was regarding a question I received from this blog: Hello, I am hoping to find some help. I have an Access DB that I use to collect data. I have a number of different reporting features. I would like to add the option for my user to export to excel. When I do this […]

Continue Reading

How To Find Certain Files In VBA

Someone wanted to loop through the files in over 100 directories and find a list of their powerpoint files. This code will loop a specific directory and check if a file with a “pptx” extension exists in that directory. If it does, a message box will be displayed. Instead of the message box, the file’s […]

Continue Reading

How To Extract Data From Outlook To Access With VBA

In this post you are going to find out how you can extract data From Outlook to Access with VBA”. Someone at the place I’m working at was let go, and they wanted the information, primarily from the user’s Outlook inbox, to be extracted to an outside application so the particular information about various projects […]

Continue Reading

VBA For Loop

Use the VBA For Loop when you know how many iterations the code should make. Using this VBA For Loop will allow you to loop for a specific number of times. Take a look at the video: The syntax for the VBA For Loop is: ****************************************** For counter= start To end [Step backward count (how […]

Continue Reading