List of a macro's commands in VBA?

jasmith4

Active Member
Joined
May 16, 2008
Messages
337
When you open a macro in Design mode, you get the four columns, Macro Name, Condition, Action (with the parameter below) and Comment. Where is this list of actions in VBA? I've searched the database's Scripts container, the project's AllMacros collection, all properties for both -- nothing. EVen when I leave a macro open in design mode and examine all these with the VBE's Watch Window, nothing shows up.

The reason I ask is: I have a system to export all VBA code to text files, overwriting only the ones that change, so that I can do meaningful version control. So modules' lines of code and even a project's references are accessible via VBA -- but not macros' actions? Really?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
That is my I avoid macros. No easy way to document or have any kind of versions control.

The only macros I might use are the special autoexec and autokeys macros. And that is only it I must.
 
Upvote 0
Depends on what you're calling a macro.
When you use DoCmd, for example, you're actually running macros with it.

Something I read a long time ago:
http://www.fabalou.com/Access/AccessRants/trouble_with_access_2.asp


Historically, access has always had quirks where some functionality is sort of kludged together to make it work and sometimes requires unexpected tweaks to make things work. I remember adding this line, for example, to a process that ran into a record locking issue because it read through them too quickly.

DAO.DBEngine.SetOption dbMaxLocksPerFile, 30000
 
Upvote 0
Macros. The regular UI macros you see in the database window when you click Macros under Objects in the left-side navigation pane. The things with the icons that look like little yellow paper scrolls. Not modules, macros.

For example, I always make a macro when I create any database called AutoExec, which Access always looks for and executes. It has two actions, RunCommand DocMaximize and RunCommand AppMaximize.

How in VBA can I examine that macro's list of actions?
 
Upvote 0
Macros. The regular UI macros you see in the database window when you click Macros under Objects in the left-side navigation pane. The things with the icons that look like little yellow paper scrolls. Not modules, macros.

For example, I always make a macro when I create any database called AutoExec, which Access always looks for and executes. It has two actions, RunCommand DocMaximize and RunCommand AppMaximize.

How in VBA can I examine that macro's list of actions?

I just though of something ...

I found a old database that did have an AutoExec marco and ran this in the immediate window:

Code:
SaveAsText acMacro,"AutoExec", "C:\myapp\autoexec_macro.txt"

This exported the macro contents to a text file that you can read.

Does that help?

Boyd Trimmell aka HiTechcoach
Microsofft MVP - Access Expert
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,256
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top