How can I start a macro in MS Access with database activities?

Hi all,
I am using the database activities to connect to a MS Access database. The connection is working fine :wink:
Now I would like to start the Macro “Gesamtabfrage” with these database activities. How can I do this? I want to avoid clicking the UI elements.

Any help is highly appreciated.

Thanks a lot in advance,

@Omit - Did you ever find a solution to this topic? I’m having the same issue currently…

dunno if you found the solution, but i will leave this where :slight_smile: RPA Listings - Collections, Integration Packs | UiPath Marketplace

@MikeHoncho take a look :stuck_out_tongue:

@fmsimoes - That was actually the first thing I tried but ran into issues, likely because Access isn’t installed on the machine running the Execute Macro activity.

Here’s the error for reference:
Retrieving the COM class factory for component with CLSID {73A4C9C1-D68D-11D0-98BF-00A0C90DC8D9} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

in that case i’m out of ideas :frowning:

Hi guys,
thank you for your reply.
I wanted to try this activity but we are not allowed to use it ;-(
So far I am double clicking the query in order to execute.
Still dont have a solution for it.

Try this: Use the start process activty.
First argument is the .exe of access. example : “C:\Program Files\Microsoft Office\Office16\MSACCESS.EXE”

Second argument is the database file “”“C:\User\Myself\Path with spaces works\MyDB.accdb”“” + " /x macro_name_here"

Triple quotes allows spaces in the name but doesn’t allow /x. So to handle both cases, you triple quote the path, then add on a single quote string. Note the space at the start of the second string ‘/x’ is a command line argument that allows specification of a macro name. I sometimes get a message saying I don’t have exclusive rights to the DB which may need to be handled separately. However, this should start Access, and then run a macro inside the DB specified.

Here is the support document from Microsoft.

Hi Brian,

thx a lot for your solution. I really appreciate your reply.
I was testing according to your description and it is working fine.

I only wish @uipath would provide an activity like the execute MSExcel macro for the execution of my MSAccess macro. Because the start process activity only starts the macro but doesnt know when its done.

Anyway your solution definitively made my automation even more stable.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

This is an addition to the topic “How can I start a macro in MS Access …”. The solution described there works, but I would like to add some clarification:
Microsoft uses “macro” when talking about macros and VBA code. Those who use VBA code to program Access (like me) are probably interested in how to run VBA code.
The solution described in the linked topic runs an Access macro. It does not run code. To run VBA code you need to

  • create a macro in Access
  • in the macro you choose activity “RunCode”
  • in the RunCode action you have to name a function (not a sub) that RunCode shall run. Do not forget the () or optional parameters in brackets at the end of the function name.
  • you either write your VBA code, which is normally a sub, as a function (the code will run just as well) or
  • you write a VBA function that does nothing but call the sub that you want to run.
    So, the sequence is:
    UiPath calls the Access macro
    the macro runs the VBA function
    the function calls the VBA sub

PS: Sorry if the title looks weird. The field said “paste a link”. I did not know if I can make the title more readable without destroying the link.

@Achi - I moved your post to the mentioned topic.