Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Macro to run an Existing Microsoft Access Macro

Hi - I am trying to automate the running of an Access Macro without going
into Access. The access macro using the Transferspreadsheet action.

While the macro below works it has 2 problems:
1 - Since it's in the excel book that the Access macro is trying to update
it waits until the Excel book is closed - hence is it possible to force
Access to update excel that is already open.
2 - The Access macro opens a Db2 database which asks for a username /
pasword, hence is it possible to pass the username / password from the Excel
book from two cells?

The macro in Excel that I am using is:

Sub AccessTest1()
Dim A As Object
Set A = CreateObject("Access.Application")
'A.Visible = False 'I recommend this is remmed to begin with
A.OpenCurrentDatabase ("C:\eESM Reporting\Equinox eESM Web Reporting.mdb")
'update with details of your .mdb file
A.DoCmd.RunMacro "Web Extract" 'update with the name of your Access macro
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Macro to run an Existing Microsoft Access Macro

Try something like this:

Sub AccessTest1()
Dim AccApp As Access.Application
Set AccApp = CreateObject("Access.Application")
'A.Visible = False 'I recommend this is remmed to begin with
AccApp.OpenCurrentDatabase ("C:\eESM Reporting\Equinox eESM Web
Reporting.mdb")
'update with details of your .mdb file
AccApp.DoCmd.RunMacro "Web Extract" 'update with the name of your Access macro
AccApp.Quit
End Sub

Ensure that in the references, you've chosen the Microsoft Access Object
Library.
--
HTH,
Barb Reinhardt



"Paul Dennis" wrote:

Hi - I am trying to automate the running of an Access Macro without going
into Access. The access macro using the Transferspreadsheet action.

While the macro below works it has 2 problems:
1 - Since it's in the excel book that the Access macro is trying to update
it waits until the Excel book is closed - hence is it possible to force
Access to update excel that is already open.
2 - The Access macro opens a Db2 database which asks for a username /
pasword, hence is it possible to pass the username / password from the Excel
book from two cells?

The macro in Excel that I am using is:

Sub AccessTest1()
Dim A As Object
Set A = CreateObject("Access.Application")
'A.Visible = False 'I recommend this is remmed to begin with
A.OpenCurrentDatabase ("C:\eESM Reporting\Equinox eESM Web Reporting.mdb")
'update with details of your .mdb file
A.DoCmd.RunMacro "Web Extract" 'update with the name of your Access macro
End Sub


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
Use VBA (Macro) to Update Existing Macro Jordan Marton Excel Programming 6 February 14th 07 01:16 PM
Macro to Export Selected fields to an Existing Access Database ernie Excel Programming 1 March 13th 06 05:01 PM
Use existing macro to create another macro fullers Excel Programming 1 February 16th 06 09:56 AM
Recording a macro within existing macro. BBQDad[_2_] Excel Programming 2 February 9th 05 10:09 PM
Launch Macro in Access via Macro running in Excel??? dgrant Excel Programming 1 September 24th 03 01:38 PM


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