Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Access Macro in a Module

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Access Macro in a Module

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Access Macro in a Module

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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Access Macro in a Module

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Access Macro in a Module

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Access Macro in a Module


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


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


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=145834

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel macro in Access module I.M. Shatner Excel Programming 7 August 10th 09 09:01 PM
Access variable from form and module? parkin_m Excel Programming 1 August 8th 07 03:32 PM
macro in excel to call a access module to run. [email protected] Excel Discussion (Misc queries) 0 April 23rd 07 08:59 PM
Formatting Excel from an ACCESS MODULE [email protected] Excel Programming 3 March 28th 07 07:00 PM
Running Excel module within Access Id10 Terror Excel Programming 1 September 11th 05 07:50 PM


All times are GMT +1. The time now is 09:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"