Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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


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
Opening an Access Database and running procedure Via Excel VBA Paul Faulkner Excel Programming 0 June 7th 06 02:17 PM
Can you open Access Database through Excel VBA? dj Excel Programming 4 May 9th 06 01:27 AM
Open Access Database from Excel Manuel Excel Programming 1 January 12th 06 07:27 AM
Open Access Database through Excel jojo Excel Programming 3 March 3rd 05 06:53 PM
Can't re-open Access database from Excel VBA Helge V. Larsen[_3_] Excel Programming 0 November 4th 04 09:03 AM


All times are GMT +1. The time now is 02:27 AM.

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

About Us

"It's about Microsoft Excel"