Macro in swithc board

pltnsgt

New member
Local time
Yesterday, 22:29
Joined
Sep 27, 2006
Messages
9
I have a problem where I was trying to create a Macro to open a Excel dcoument from Access and run the Excel Macro, all from switchboard. And it works.
When I activate the Macro from Switchboard the Visual Basics screen appears and have have to press the play button for it to work. Is there anyway I can change it where visual basic runs the macro without me having to press the play button? Here is my code:

Sub MasterKey()

Dim XL As Object
Set XL = CreateObject("excel.Application")

With XL.Application
.Visible = True
.workbooks.Open "C:\Korea\MASTER MACRO.xls"
.Run "Auto_Open"
.Quit
End With

Set XL = Nothing

End Sub

I created a module with the above script, Then a Macro to run the module (OpenModule / Compile data), then added it to the switchboard as RunMacro / Complie Data.

What did I miss? Thanks.
 
On the OnClick event of the button put the following code:

Call MasterKey

that should do it.

Dave
 

Users who are viewing this thread

Back
Top Bottom