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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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?
 

wigwam

New Member
Joined
Jul 31, 2002
Messages
42
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
 

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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
 

Forum statistics

Threads
1,144,150
Messages
5,722,796
Members
422,459
Latest member
Chriselff

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
Top