Preventing multiple Excel instances

skper

New Member
Joined
Oct 29, 2016
Messages
2
Hello MrExcel-Forum,

there once was a computer,
who at certain times, ran a batch-file via the task-scheduler,
the batch-file starts an xlsm-file,
and the xlsm-file used "thisWorkbook.close false" at the end of their vba (in workbook.open. the "false" means that changes are not saved).
there was only one instance of Excel running at all times in which the xlsm-files run themselves in when triggered.
and everyone lived happily ever after...

until at some point an xlsm-file got triggered while another is still calculating.
then this happened: the new xlsm-file starts ANOTHER instance of Excel.
so i come home to this:
multiple_Excel.png


whenever this happens, there starts another instance of excel.
so after a week, there is like 20 of them. This was my problem.

There are multiple solutions that i could imagine:
Ideal would be that the xlsm-file closes its instance of Excel if there is another running.
Eventually using thisApplication.Quit once every hour could work, but it could collide with an xlsm-file.
Or to somehow queue the workbooks? Maybe run multiple Workbooks in one instance?

Thank you very much in advance
skper
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
The following line in a BAT file opens YourFile.xlsm in the same instance
with an already open Excel file (tested on Win 7 with Excel 2010/2013):


Code:
start "" "C:\Path\to\Your\Folder\YourFile.xlsm"
 
Upvote 0
works perfectly. it even queues the xlsms until the previous workbook closed.
Thank you very much, Tetra201!
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,435
Members
452,326
Latest member
johnshaji

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