ReOpen thisworkbook in new instance through VBA

Ramachandran

New Member
Joined
Oct 17, 2011
Messages
47
I need to make a certain workbook be open in a seperate instance of Excel. I am aware that you can open a new instance of Excel and then open the file, unfortunately not all users of this file are aware of this.

Code:
Private Sub Workbook_Open()

    If Application.Workbooks.Count > 1 Then
           Dim newBook As Object, oldBook As Object
           Dim oldBookName As String
           
           Set oldBook = ThisWorkbook
           oldBookName = oldBook.FullName

           Set newBook = CreateObject("Excel.Application")

           newBook.Workbooks.Open (oldBookName)
           newBook.Visible = True
           oldBook.Close savechanges:=False
    End If
...

This code opens a new instance of the file (newBook) and closes the original one (oldBook) if there's other Excel files open. Only trouble is that the newBook now is ReadOnly. Is there any way to ReOpen this workbook in a new instance of excel (if other instances are open) and let the file not be read only?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Is there a way to reopen the file in read/write to avoid seeing the read/write message?
 
Upvote 0

Forum statistics

Threads
1,215,504
Messages
6,125,183
Members
449,212
Latest member
kenmaldonado

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