Check My Code Please - Execute Access Macro
Actually that fixed that part. I'm getting anotehr error now but I think I
can get past this one myself.
"PapaDos" wrote:
I guess you are not using Access as a front end to an SQL database ?
Then don't use the "OpenAccessProject" method, use "OpenCurrentDatabase"
instead...
--
Regards,
Luc.
"Festina Lente"
"Lythandra" wrote:
Hi,
I'm trying to import in a rather complicated series of queries from Access
into Excel.
I have set a macro up in the Access database which works fine when I run it
from Access.
What I am trying to do is get this macro to run from within a specific Excel
file.
Here is my code which I found on here by searching:
Sub RunAccessMacro()
Dim appAcc As Access.Application
Set appAcc = New Access.Application
appAcc.Visible = True
appAcc.OpenAccessProject ("C:\Test.mdb")
appAcc.DoCmd.RunMacro ("mcr Export To Excel WIP")
appAcc.Quit
Set appAcc = Nothing
End Sub
I have also set a reference up within Excel using (Tools - References -
Microsoft Access 9.0 Object Library).
Now what is happening is that Excel is opening up Access just fine but not
the actual specific database. I have even simplified the database location
and name just to test it.
Does anyone see anything wrong with what I am doing?
Thanks
|