Force Macro to Open Excel File in New Instance

DougRobertson

Active Member
Joined
Sep 22, 2009
Messages
334
Office Version
  1. 365
Platform
  1. Windows
Hello,

Just ran into a situation where I now need a Macro to open an Excel file in a new Instance, instead of just the regular way. It's so that 2 Excel files can be compared to each other, side by side, in completely different Windows.

Is that possible?

Thanks as always in advance - Mr. Excel is the greatest!

~ DWR
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Here are 2 manual options to open your workbook in its own instance. A macro is possible, if you need that post back.

Option 1

TET1a.png


TET1b.png


Option 2

TET1c-1.png


TET1d.png


Option 2, Step 3, click Yes when prompted if you want to start a new instance.
 
Last edited:
Upvote 0
Thanks for your quick response Tom - yes, I need the Macro to open the new Instance so I'm looking for the VBA code for that. I know there are options when doing this manually - Read Only, Notify, and the always popular "X" out, so is there also Code to force those parameters as well?

Thanks!
 
Upvote 0
Modify for file name.

<code>
Sub NewInstance()
Dim NewExcel As Object
Set NewExcel = New Excel.Application
With NewExcel
.Visible = True
.Workbooks.Open "C:\Your\File\Path\YourFileName.xlsx"
End With
End Sub
</code>
 
Upvote 0
Oh, just noticed - the new Instance always seems to come up behind the original Workbook.

Is there a way to ensure the new Instance always comes up on top? I see you're using the

Code:
    .Visible = True

code, but that doesn't seem to do the trick.
 
Upvote 0
Hello,

Just ran into a situation where I now need a Macro to open an Excel file in a new Instance, instead of just the regular way. It's so that 2 Excel files can be compared to each other, side by side, in completely different Windows.

Is that possible?

Thanks as always in advance - Mr. Excel is the greatest!

~ DWR

Just curious, do the files/workbooks have the same filename? And are both files being opened by (presumably) a third workbook with the code?

Mark
 
Upvote 0
Good question, but no - the file names are completely different.

I've created an Excel Dashboard, and upon entering the Call Letters of a radio or TV station in a specific cell then hitting Enter, a Sheet Level Macro retrieves the Workbook of that Station, and opens it in a New Instance of Excel.

It all works well enough, but I'd like the New Instance of the Radio Station to always come up on top of the Dashboard window.

Is there a way to force that to happen?

I appreciate your interest!
 
Upvote 0
I've used the following code in Word documents to do a side-by-side comparison:

Code:
    Windows.CompareSideBySideWith compareKey 'compareKey is a variable holding the name of the document opened in the background
    Windows.SyncScrollingSideBySide = True
    Windows.ResetPositionsSideBySide

Not sure if this can be adapted to work in Excel or not....

Regards,

CJ
 
Upvote 0
Great code for sure CJ, and it does work in Excel - it's one of my favourite (hey, I'm Canadian) commands! It works amazingly well.

This new concept doesn't require that specific a setup every time, but it's more how the windows stack up on the screen - I need the New Instance (Radio Station in this example) on top if possible.

Thanks for your ideas!
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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