Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you view macro code in access?

Tags:

I have a Microsoft Access database and there is a macro there. How do I view the code of the macro?

like image 254
Alex Gordon Avatar asked Aug 28 '09 04:08

Alex Gordon


People also ask

How do I edit an existing macro in Access?

To edit a standalone macro in Access, right-click the name of the macro to edit in the Navigation Pane. Then select the “Design View” command in the pop-up menu that appears to open the macro design view window. In this view, change the macro actions and arguments, as needed, and then save it again.

How do I open an embedded macro in Access?

Locate the macro in the Navigation Pane, then double-click the name. On the access database Tools tab, in the Macro group, click Run Macro, then select the macro from the list, and then click OK.

How do I find hidden macros in Access?

Goto the View Tab and check the Hidden objects checkbox from the show Frame. Then right-click on the query in question, select properties and unselect the hidden attribute. At this point you are probably best to go back into the options an unselect the Hidden objects checkbox.

How do I run a macro in Access?

If you enter a macro group name for the Macro Name argument, Access runs the first macro in the macro group. This action is similar to clicking Run Macro on the Database Tools tab, selecting a macro, and clicking OK.


Video Answer


2 Answers

Open the Access Database, you will see Table, Query, Report, Module & Macro.
This contains the macros which can be used to invoke common MS-Access actions in a sequence.

For custom VBA macro, press ALT+F11.

like image 155
shahkalpesh Avatar answered Sep 30 '22 01:09

shahkalpesh


You can try the following VBA code to export Macro contents directly without converting them to VBA first. Unlike Tables, Forms, Reports, and Modules, the Macros are in a container called Scripts. But they are there and can be exported and imported using SaveAsText and LoadFromText

Option Compare Database  Option Explicit  Public Sub ExportDatabaseObjects() On Error GoTo Err_ExportDatabaseObjects      Dim db As Database     Dim d As Document     Dim c As Container     Dim sExportLocation As String      Set db = CurrentDb()      sExportLocation = "C:\SomeFolder\"     Set c = db.Containers("Scripts")     For Each d In c.Documents         Application.SaveAsText acMacro, d.Name, sExportLocation & "Macro_" & d.Name & ".txt"     Next d 

An alternative object to use is as follows:

  For Each obj In Access.Application.CurrentProject.AllMacros     Access.Application.SaveAsText acMacro, obj.Name, strFilePath & "\Macro_" & obj.Name & ".txt"   Next 
like image 24
Michael Dillon Avatar answered Sep 30 '22 03:09

Michael Dillon