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

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
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,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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