Running a Subroutine on Open ABNORMALLY

hicksi

Board Regular
Joined
Mar 5, 2012
Messages
203
I have Excel as my data with a set of forms (ie, a system utilising Excel - because I CANNOT use C# or VB# due to company policy).
Usually it starts and displays the main form... NO PROBLEM
It also contains code-save & sheet-save subroutines. I want to run those (without running the forms).

Is there a command-line version such as
Code:
EXCEL MYFILE.XLSM -RUN ExportCode
which will open MYFILE.XLSM and run my ExportCode subroutine and then exit?
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
And I just found THIS code on https://wellsr.com/vba/2015/excel/run-macro-without-opening-excel-using-vbscript/

Code:
<code class="language-vb" data-lang="vb">
'Code should be placed in a .vbs file 
</code><code class="language-vb" data-lang="vb">Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "'C:\Users\Ryan\Desktop\Sales.xlsm'!SalesModule.SalesTotal"
objExcel.DisplayAlerts = False
objExcel.Application.Quit
Set objExcel = Nothing</code>

Haven't tried it (yet)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,558
Messages
6,114,297
Members
448,564
Latest member
ED38

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