How to open Excel in new instance?

dmadhup

Board Regular
Joined
Feb 21, 2018
Messages
146
Office Version
  1. 365
Hello,

I am using Office 365 and when I open two Excel file then it opens on the same instance. For some reason, I am looking to open in a separate instance.
Anyone has an idea how to achieve it. I appreciate your response.

Thank you!
 
1. Yes, it opens in a separate instance.

2. I just double click on the file to open

3. I am using Excel 2016 (Office 365)

Hope it helps.

Thank you, Jaafar!
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Ok- I am assuming you have an already open excel before clicking on the file to open - Right ?

so now, does the workbook in the seperate instance opens at the back of the already open instance ? If that's what you are saying, what happens if you switch to the new ly open file instance manually ? Do you then see the userofm at the front ?
 
Upvote 0
Yes, I have already opened more than one excel file.

Now if I open the new excel with your code then it does open in new Instance.---Yes. But not able to get the form in front. No, I am not getting even I switch manually.
 
Upvote 0
Moreover, When I open the Excel file with this code, my file header says" Read Only.....and freeze there. Not able to click anything. Any my login form sitting behind the freeze window

Thank you!
 
Upvote 0
Hi dmadhup,

I am not sure why it is not working for you .. The code works for me just fine .. it could be due to the office version that you are using which is different than mine ( mine is office 2010).

Maybe someone else can join the thread and spot the problem .

Good luck.
 
Upvote 0
Thank you, Jaafar for your valuable time.
Yes, look like it's because of office 365 I am using.
 
Upvote 0
Hi,
Yes, it's because of switching to SDI in Excel 2013+ versions.
Try this modification of the code:
Rich (BB code):
' Put all the below code into ThisWorkbook module
 
Option Explicit
 
Private Sub Workbook_Open()
  Application.OnTime Now, Me.CodeName & ".MyOpen"
End Sub
 
Private Sub MyOpen()
  Dim oAddIn As AddIn
  ' Change access to read only
  Me.Saved = True
  Me.ChangeFileAccess xlReadOnly
  ' Create new instance of Excel
  With New Application
    ' Activate Excel AddIns in the new instance
    For Each oAddIn In .AddIns
      If oAddIn.Installed Then
        oAddIn.Installed = False
        oAddIn.Installed = True
      End If
    Next
    ' Activate window
    .Visible = True
    .WindowState = xlMaximized
    ' Load workbook
    .EnableEvents = False
    .Workbooks.Open Me.FullName
    .EnableEvents = True
    ' Show the form
    .OnTime Now, Me.CodeName & ".ShowUserForm"
  End With
  ' Close the read only copy of workbook
  Me.Close False
End Sub
 
Private Sub ShowUserForm()
  LoginForm.Show
End Sub
 
Last edited:
Upvote 0
Thanks ZVI for providing the answer.

I was aware of the new SDI feature on excel 2013 but never had a chance to test or experiment as I use excel 2010.

I'll have a read of the MSDN link you provided.

Regards.
 
Upvote 0
Thanks ZVI for providing the answer.
Jaafar, it's just a bit modified your code, successfully tested on my PC Win10 Excel 2016 64bit.
But programming with SDI sometimes puzzels me deeply.
Regards,
Vlad
 
Last edited:
Upvote 0
Thank you, Jaafar and ZVI for answers.
And good to know about SDI. I really appreciate for help.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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