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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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