PC Review


Reply
Thread Tools Rate Thread

Access Macro in a Module

 
 
MarkS
Guest
Posts: n/a
 
      20th Oct 2009
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


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      20th Oct 2009
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?



MarkS wrote:
>
> 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


--

Dave Peterson
 
Reply With Quote
 
MarkS
Guest
Posts: n/a
 
      20th Oct 2009
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
 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      20th Oct 2009
can you convert the macro into a query? (ie a SQL statement)

"MarkS" wrote:

> 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

 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      20th Oct 2009
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



"MarkS" wrote:

> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call a public module macro in private module macro emmanuel Webmaster / Programming 1 13th May 2011 06:34 PM
Excel macro in Access module I.M. Shatner Microsoft Excel Programming 7 10th Aug 2009 09:01 PM
Macro Excel in Access module Patrice Microsoft Access VBA Modules 1 5th Jan 2009 08:02 PM
macro in excel to call a access module to run. Pete-Peters@sbcglobal.net Microsoft Excel Misc 0 23rd Apr 2007 08:59 PM
Re: EXCEL Macro versus ACCESS Module?? Jim Carlock Microsoft Excel Programming 0 19th Sep 2003 01:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:42 PM.