• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 11. What Are Macros and When Do ... > Converting a Macro to VBA Code

Converting a Macro to VBA Code

Now that you have discovered all the limitations of macros, you might be thinking about all the macros you've already written that you wish you had developed by using VBA code, or, after seeing how easy it is to do certain tasks by using macros, you might be disappointed to learn how limited macros are. Fortunately, Access 97 comes to the rescue. It's easy to convert an Access macro to VBA code—once the macro has been converted to VBA code, the code can be modified just like any VBA module. Follow these seven steps to convert an Access macro to VBA code:

1.
Open the macro you want to convert in Design view.

2.
Choose File | Save As/Export.

3.
Click the Save as Visual Basic Module option button. (See Figure 11.19.)

Figure 11.19. The macro File | Save As/Export dialog box allows you to save a macro as a Visual Basic module.


4.
Click OK; this opens the Convert Macro dialog box. (See Figure 11.20.)

Figure 11.20. Use the Convert Macro dialog box to indicate whether error handling and comments will be added to the Visual Basic module.


5.
Indicate whether you want to add error handling and comments to the generated code, then click Convert.

6.
After you get an indication that the conversion is finished, click OK.

7.
The converted macro appears under the list of modules with “Converted Macro:” followed by the name of the macro. Click Design to view the results of the conversion.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint