Sign in to follow this  
Followers 0
foamRoller

Running a macro in Access

2 posts in this topic

I'm trying to run a Access DB macro. Right now I'm getting a syntax error, couldn't find much help in the last couple of hours. :(

In the longterm, I'd like to have a GUI list of all the macros in that particular DB, and allow the user to choose which macro to run.... in this snippet, $db is the .accdb file path.

$accApp = ObjGet($db,"")
$macro = ObjCreate("Access.AllMacros.Application")
$dbs = $accApp.CurrentProject

for $macro in $dbs.AllMacros
    If $macro.IsLoaded = True Then
        ConsoleWrite(ObjName($macro))
    EndIf
Next $macro

$accApp.CloseCurrentDatabase

Share this post


Link to post
Share on other sites



#include "boc-library.au3"

$accApp = ObjGet($bocdb,"")
$macro = ObjCreate("Access.AllMacros.Application")
$dbs = $accApp.CurrentProject

for $macro in $dbs.AllMacros
   MsgBox(1, "macro", ObjName($macro))
Next

Here's a running version, all of the msgboxes come up as "Access Object" - is there some way to get the actual macro name? Still wondering how to run it too...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0