View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default Open MS Access Database and running it's maco from Excel

Sub RunAccessMacro()
Dim appAcc as Access.Application

'Open Access or use it if already running
Set appAcc = New Access.Application
'Optional to show or hide Access
appAcc.Visible = True
'open desired database
appAcc.Open "C:\path\db1.mdb"
'to run Access macro
appAcc.DoCmd.RunMacro "MyAccessMacro"
'more optional code
'Close Access
appAcc.Quit
Set appAcc = Nothing

End Sub


You will need to set a reference in Excel to the Access
object library. Use menu Tools | References, and find
"MicrosoftAccess XX.0 Object Library," and check it.

Hth,
Merjet