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?
 

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
743
Is there a way to reopen the file in read/write to avoid seeing the read/write message?
 

Forum statistics

Threads
1,085,465
Messages
5,383,849
Members
401,857
Latest member
kevin67

Some videos you may like

This Week's Hot Topics

Top