Running macro in different instance of excel

St Jimmy

New Member
Joined
Oct 29, 2015
Messages
36
I'm receiving out of resources errors in Excel 365 (32-bit, 64-bit remedies the problem but our IT wont allow it for the number of users that would use this book, so I'm stuck with 32-bit). I have plenty of RAM so I'm trying to split the two workbooks into difference instances to allow more memory allocation (if this is a bad strategy I'd be happy to know why/alternatives!). My set-up has two workbooks, Workbook A opens Workbook B and Workbook B runs the heavy lifting code and then transfers the data back to Workbook A in value format. It worked fine before I started mucking around with the instances so I think the issue is the way I'm calling the macro in Workbook B.

WorkBook A Code:
Code:
Dim WkbB As Object
Set WkbB = New Excel.Application
With WkbB
    .Visible = True
    .Workbooks.Open "P:\Root\WorkbookB.xlsm", True, False
End With

Application.Run "'WkbB.xlsm'!Main"

Workbook B opens in its own instance as desired but when the code gets to the Application.Run line it opens WorkbookB again but in the same instance as WorkbookA defeating my strategy.

Is there a way I can specify the instance of excel in the Application.Run line?

Thank you!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I figured it out and wanted to post for reference.

Change the last line of code from
Code:
Application.Run "'WkbB.xlsm'!Main"
to
Code:
WkbB.Run "'WorkbookB.xlsm'!Main"

Dear future user, you're welcome ;)
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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