ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Access Macro from Excel (https://www.excelbanter.com/excel-programming/432870-run-access-macro-excel.html)

Paul W Smith

Run Access Macro from Excel
 
I have code that runs a Access query on an Access DB when called from within
an Excel Application, but I am wondering if there is any way to run a Access
Macro.

Bascially all the Macro does is call 8 queries in turn. I know I could run
each of them from Excel, but I wonder if there is a way to utilise the macro
from Excel?

Paul Smith



arjen van der wal

Run Access Macro from Excel
 

Hi Paul,

In Excel Visual Basic Editor you'll have to add a reference to the
Access Object Library: Tools References Microsoft Access Object Library

The general format is as follows:

Sub AccessMacro()

Dim ac As Access.Application
Set ac = New Access.Application

ac.Visible = True

ac.OpenAccessProject ("S:\FINOPS\Data\TransQuery.mdb")

ac.DoCmd.RunMacro "DailyImports"

ac.Quit

Set ac = Nothing

End Sub

Not really my macro. Copied pretty closely from Excel & Access
Integration by Michael Alexander. Hope it helps.




All times are GMT +1. The time now is 01:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com