Access Macro in a Module

M

MarkS

Hi,

I want to run a access macro which is in a module for Excel. I have tried
aAccess.DoCmd.RunMacro "GetNewAFMAGreen" which gives me a error - Microsoft
Access can't find the macro 'GetNewAFMAGreen.'@
What do I do now to run it

Thanks MarkS
 
D

Dave Peterson

This is VBA for Access that's stored in a module in an excel workbook?

I'd be very surprised that you could even get the code to compile in excel...

I don't speak the Access, but couldn't you keep the code there and run it from
Excel?
 
M

MarkS

Found out a bit more I am in Excel trying to run the access Procedure I use
this code
' Set up
Set aAccess = New Access.Application
aAccess.Visible = True
' Open the database
aAccess.OpenCurrentDatabase ("S:\STAR\risk\Quantitative Risk\Forward
Curve\AFMA Green\AFMA_Green.mdb")
' Run the Procedure
aAccess.DoCmd.OpenModule "Load AFMA Data", "GetNewAFMAGreen"
' aAccess.DoCmd.RunMacro "GetNewAFMAGreen"
' Clean up and shut down
aAccess.Quit
Set aAccess = Nothing

unfortunately it still has the same problem

Thanks MarkS
 
P

Patrick Molloy

when you say it doesn't work, you must be getting some messages back?

This code - in an EXCEL Standard Module - opens an Access database and
executes a procdure in the Access Database's standard module.

in my example the sub "AddAColumn" is in Module1 of the Access Database's
code module's


Sub contoAccess()
Dim aAccess As Object 'Access.Application
Set aAccess = CreateObject("Access.application")
aAccess.Visible = True ' not required' Open the database
aAccess.OpenCurrentDatabase ("E:\Excel\Excel_Demos\Risk.mdb")
aAccess.Run "AddAColumn"
' Clean up and shut down
aAccess.Quit
Set aAccess = Nothing
End Sub
 
J

joel

Excel won't look for names in another workbook unless you tell it wher
it is located. what si tthe error you are getting and at which lin eo
code.


aAccess.DoCmd.OpenModule "AFMA_Green.mdb!Load AFMA Data", _
"GetNewAFMAGreen
 
Top