Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use VBA (Macro) to Update Existing Macro | Excel Programming | |||
Macro to Export Selected fields to an Existing Access Database | Excel Programming | |||
Use existing macro to create another macro | Excel Programming | |||
Recording a macro within existing macro. | Excel Programming | |||
Launch Macro in Access via Macro running in Excel??? | Excel Programming |