Opening new session of Excel

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,924
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I use the following code to force Excel to open a new session every time it's run:

Code:
Sub Workbook_Open()

Dim oXL As Excel.Application

If Workbooks.Count > 1 Then
    
    Set oXL = CreateObject("Excel.Application")
    oXL.Visible = True
    oXL.Workbooks.Open ThisWorkbook.FullName
    AppActivate oXL.Caption
    ThisWorkbook.Close False
   
End If

End Sub

Why is it when I open my workbook, it's Read-Only, then after about 5 secs, a message pops up stating the file is now available for editing?

Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Why do you have code in a workbook that opens that workbook again in a new instance of Excel?
 
Upvote 0
What are you trying to do with the code that you can't already do within the instance of Excel the workbook is originally opened?
 
Upvote 0
Scenario 1:

Suppose I turn on my PC, then open my program via Windows Explorer (WE). Obviously Excel opens, call that session 1.

If I go to WE and open another Excel file, I want that file to be opened in another session of Excel. (Any subsequent Excel files should also be opened in sessions 2 or later, not too bothered, as long as it's not in session 1).

The above can be achieved by setting:

Code:
Application.IgnoreRemoteRequest = False

in my program.

Scenario 2:

A session of Excel is already open.

Opening my program via WE, I WANT it to open in session 2. Opening another subsequent Excel file, I want that to open in session 3, etc.

Scenario 2 cannot totally be achieved using IgnoreRemoteRequest. All IgnoreRemoteRequest does is force subsequent Excel files to be opened in a separate session of Excel but it does NOT open my program in a separate session of Excel, IF a session is already open.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,301
Members
452,633
Latest member
DougMo

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