Excel; Macros

wigwam

New Member
Joined
Jul 31, 2002
Messages
42
Can anyone tell me if it's possible to start an Excel workbook giving the name of a macro to run. Don't want to use auto_open 'cos that runs each time they open (except hitting shift) but don't want to have to do that.

Any help appreciated
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
On 2002-10-02 08:40, wigwam wrote:
Can anyone tell me if it's possible to start an Excel workbook giving the name of a macro to run. Don't want to use auto_open 'cos that runs each time they open (except hitting shift) but don't want to have to do that.

Any help appreciated

Can you explain under what conditions you need the macro to run, please?
 
Upvote 0
I wanted to run the macro from a command line (using ACCESS) eg.

excel.exe "\wiggumibbreportsExceptions Summary.xls "

but not run it if the spreadsheet is opened manually as normal.

Hope thats clear ?

cheers
 
Upvote 0
On 2002-10-02 09:25, wigwam wrote:
I wanted to run the macro from a command line (using ACCESS) eg.

excel.exe "wiggumibbreportsExceptions Summary.xls "

but not run it if the spreadsheet is opened manually as normal.

Hope thats clear ?

cheers

Place the code in a module then use the following in Access:

Private Sub Command0_Click()

Dim xlApp, xlBook As Object

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add("D:MrExcelCallExcelMacroTest.xls")

xlApp.Visible = True

xlApp.Application.Run "YourSubName"

Set xlApp = Nothing
Set xlBook = Nothing

End Sub
 
Upvote 0

Forum statistics

Threads
1,218,522
Messages
6,142,956
Members
450,456
Latest member
Exidur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top