Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default OpenAccessProject

I want to run an Access Macro via Code from Excel, however I am getting an
error in Access I believe because the MDB is set up to open a menu form
automatically on open. I can get around it when opening Access by holding
the shift key down. What I would like to know is there away via code to do
the same thing so I can just run the macro?

Here is my code:

Dim appAcc As Access.Application

'Opens Access or gets reference to app already running
Set appAcc = New Access.Application

'Optional to show or hide Access
appAcc.Visible = True
appAcc.OpenAccessProject ("O:\Resources\O36 Databases\CPAP\O36_CPAP.mdb")


'For running a regular Access macro
appAcc.DoCmd.RunMacro "CPAP_Qtr_Export"

'For running a VBA macro
'appAcc.RunMacro "MyAccessMacro"

'Close Access
appAcc.Quit

'This will close Access, even w/o the 'Quit' command
Set appAcc = Nothing

I am sure has to do with the " appAcc.OpenAccessProject
("O:\Resources\O36 Databases\CPAP\O36_CPAP.mdb")" line.

Thanks
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



All times are GMT +1. The time now is 12:43 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"