![]() |
Open MS Access Database and running it's maco from Excel
From Excel I want to open a MS Access Database and run a macro within it.
Can anyone please tell me the Excel VBA line code to do this? Thanks KEN |
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 |
All times are GMT +1. The time now is 12:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com