How to Convert a Standalone Macro

In this blog post, we will be showing you how to convert a Macro into VBA code.

A Macro is an object that includes a list of instructions, and these instructions translate to VBA code almost directly.  Rather than writing your code in VBA you could, and probably have already, put together a few Macros to close forms, open forms, email data, navigate records, etc.

Now, thanks to the magic of Access, we can take those Macros and convert them directly into VBA code.

Here’s how:

 

Open a Macro in design view using the Navigation Pane.  The Navigation Pane
Click on Convert Macros to Visual Basic in the Tools group of the Design tab of the ribbon.  Convert Macros to VBA
Click on convert.  Converting Dialog Box
When the conversion has finished a new Standard Module is created with all the code for the macro contained within.Just like Macros the code in the Converted Macro module is available elsewhere in your project (unlike form generated code the functions do not have the Private modifier.  The VBA Editor

How to Convert a Form’s Embedded Macros

Embedded Macros are the children of their parent form. You can tell an embedded macro from an event procedure or normal macro because the Property Sheet of the Form Events tab gives you [Embedded Macro].

 

Open the form in Design view (it won’t work in Layout view).  The Property Sheet
Click on Convert Form’s Macros to Visual Basic and you will get the same result as above.  Convert Form Macro

If you are comfortable using Macros and would like to make the step into VBA, converting Macros is an excellent way to start.

Related Posts

The Macro Designer

Leave a Reply

Your email address will not be published. Required fields are marked *

Visit Us On TwitterVisit Us On FacebookVisit Us On Youtube