Link to home
Start Free TrialLog in
Avatar of cwalker4581
cwalker4581

asked on

Run an MS Access macro using an ado connection

Is it possible to run an Access macro inside of excel using an ado connection?
Avatar of spattewar
spattewar

Why do you want to use ADO connection?

You should be able to run the Access macro by opening the access database in excel and DoCmd.Run command or something like that.
ASKER CERTIFIED SOLUTION
Avatar of spattewar
spattewar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cwalker4581

ASKER

thanks for the reply.  if possible i would prefer to do it by ado.  I feel that it uses to much overhead to open an access application just to run a macro.
You can access data from Access database using ADO but you won't be able to run macros using ADO.
Not as far as I know.

I think you have to use automation.

Dim objAcc As Access.Application    
On Error Resume Next    
Set objAcc = GetObject(, "Access.Application")    ' if access is open
If Err.Number <> 0 Then        
Set objAcc = CreateObject("Access.Application")        ' if not..
objAcc.OpenCurrentDatabase "C:\databasename.mdb"        
 End If    
objAcc .docmd.runmacro  ("macroname")    
What does your macro do?