ID: Q136058
The information in this article applies to:
Moderate: Requires basic macro, coding, and interoperability skills.
You can do a lot with macros. You can open and close forms, show and hide toolbars, and run reports. However, if you want more control over your application's behavior, you can convert your macros to Visual Basic for Applications code. To help you convert existing macros to Visual Basic for Applications code, you can use the Microsoft Access Macro Conversion Wizard. This article explains how to use the Macro Conversion Wizard, and how it converts your macro actions.
To convert a macro to Visual Basic for Applications code, follow these steps:
1. Open the sample database Northwind.mdb.
2. In the Database window, click the Macros tab, and select a macro, for
example, the Customer Labels Dialog macro.
3. On the File menu, click Save As/Export.
4. In the Save As box, click Save As Visual Basic Module, and then click
OK.
5. In the Convert Macro box, select the "Add error handling/trapping to
generated functions" option and the "Include macro comments"
option.
6. Click Convert.
The Macro Conversion Wizard does the following when it converts a macro to Visual Basic code:
No DoCmd Equivalent Solution
-----------------------------------------------------------------------
AddMenu The wizard comments out these lines in the code
and notifies the user.
MsgBox Uses the MsgBox function.
RunApp Uses the Shell function to run another
application.
RunCode Uses the Call statement and runs the function
directly in Visual Basic.
SendKeys Uses the SendKeys statement.
SetValue Sets the value directly in Visual Basic.
StopAllMacros Uses the End statement.
StopMacro Uses the Exit Function statement.
For more information about converting macros to Visual Basic for Applications code, search in the Help Index for "converting macros," or ask the Microsoft Access 97 Office Assistant.
Additional query words:
Keywords : kbprg
Version : 7.0 97
Platform : WINDOWS
Hardware : x86
Issue type : kbinfo
Last Reviewed: November 20, 1998