PDA

View Full Version : Solved: run access macro from excel



john3j
10-13-2009, 05:25 AM
Hey guys,

Is there a way to run an access macro from excel. Lets say I have test1.mdb located at R:\Test and I want to run the macro called "autoexec". I do not want access to stay open after this. The point of doing this is so that I can have access prepare my tables for me, then using a dashboard made in excel to open excel sheets that depend on these tables. If anyone could provide me with a module or something to achieve this, it would be greatly appreciated. Thanks!

Bob Phillips
10-13-2009, 05:26 AM
See this thread http://www.vbaexpress.com/forum/showthread.php?t=26739&highlight=access

john3j
10-13-2009, 06:16 AM
I see the code that you said was needed:

Sub RunAccessMacro()
Dim appAccess As Object

Set appAccess = CreateObject("Access.Application")

With appAccess
Application.DisplayAlerts = False
.Opencurrentdatabase glob_sdbPath
.DoCmd.OpenModule "Module1"
.Run "Update_data"
'.Quit
End With
Set appAccess = Nothing
End Sub


I am not sure where to put the path of my database and then the macro name. Looks like you are opening a module then running something else. Not quite sure.