Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 447
Default Run Access macro from Excel Spreadsheet

Is it possible to run an Access macro from an Excel spreadsheet?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default Run Access macro from Excel Spreadsheet

Karen

You can automate Access like so

Sub AutomateAccess()
Dim acApp As Access.Application
Set acApp = New Access.Application
acApp.OpenCurrentDatabase ("C:\db1.mdb")
acApp.DoCmd.RunMacro "Test", , ""
End Sub

This uses early binding so you will need to set a reference to the MS access
library in advance via the VBE in Excel (ToolsReferences...)

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Karen" wrote in message
...
Is it possible to run an Access macro from an Excel spreadsheet?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Run Access macro from Excel Spreadsheet

I can't get this to work --- can you help?
Sub RunAccessMacro()

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
"P:\Analytic\Heather\Individual\IndividualTurnover Report.mdb"

appAcc.DoCmd.RunMacro "Macro1: Get Data"
appAcc.DoCmd.RunMacro "Macro2: Create Report"

'Close Access
appAcc.Quit

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

End Sub

"Nick Hodge" wrote:

Karen

You can automate Access like so

Sub AutomateAccess()
Dim acApp As Access.Application
Set acApp = New Access.Application
acApp.OpenCurrentDatabase ("C:\db1.mdb")
acApp.DoCmd.RunMacro "Test", , ""
End Sub

This uses early binding so you will need to set a reference to the MS access
library in advance via the VBE in Excel (ToolsReferences...)

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Karen" wrote in message
...
Is it possible to run an Access macro from an Excel spreadsheet?


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
Copying Data from Access to Excel in a macro GLS Excel Worksheet Functions 2 November 15th 06 03:47 PM
Macro Question - Excel to Access and back again Mike The Newb Excel Discussion (Misc queries) 1 October 19th 06 02:35 PM
How to stop Excel remembering/loading macro from previously opened Workbook Norman Yuan Excel Discussion (Misc queries) 4 June 17th 06 04:13 PM
create excel spreadsheet on a data access page Pitu Excel Discussion (Misc queries) 0 October 3rd 05 08:11 PM
Open Access Database under and Excel window using a Macro BMSpell Excel Worksheet Functions 1 January 8th 05 05:32 PM


All times are GMT +1. The time now is 01:30 PM.

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"