Running macro in different instance of excel

St Jimmy

New Member
Joined
Oct 29, 2015
Messages
30
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!
 

St Jimmy

New Member
Joined
Oct 29, 2015
Messages
30
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 ;)
 

Forum statistics

Threads
1,085,222
Messages
5,382,415
Members
401,788
Latest member
zenattitude

Some videos you may like

This Week's Hot Topics

Top