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.
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?
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?