ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Acess Macro (https://www.excelbanter.com/excel-programming/344094-run-acess-macro.html)

Sandy

Run Acess Macro
 
Hello
I have added a button to my spreadsheet that I would like to Run an Access
Macro.
When I execute my code I get "Method Or Data Member Missing". I have turned
on the MS Access object Reference
This is my code

Private Sub CommandButton1_Click()

Dim appAcc As Access.Application

Set appAcc = New Access.Application
appAcc.Visible = True
appAcc.Open "G:\Mypath\Myfile.mdb"
appAcc.RunMacro "MyMcaro"
appAcc.Quit
Set appAcc = Nothing

End Sub

What am I doing wrong?
Thanks!


K Dales[_2_]

Run Acess Macro
 
I think you need to do this:
appAcc.DoCmd.RunMacro "MyMacro"
--
- K Dales


"Sandy" wrote:

Hello
I have added a button to my spreadsheet that I would like to Run an Access
Macro.
When I execute my code I get "Method Or Data Member Missing". I have turned
on the MS Access object Reference
This is my code

Private Sub CommandButton1_Click()

Dim appAcc As Access.Application

Set appAcc = New Access.Application
appAcc.Visible = True
appAcc.Open "G:\Mypath\Myfile.mdb"
appAcc.RunMacro "MyMcaro"
appAcc.Quit
Set appAcc = Nothing

End Sub

What am I doing wrong?
Thanks!



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com