View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
iliace iliace is offline
external usenet poster
 
Posts: 229
Default Always Open in New Instance

Put this code in the loader workbook's ThisWorkbook module:

Private Sub Workbook_Open()
Const strPath As String = "C:\myWorkbook.xls"

Dim xl As Excel.Application

Set xl = New Excel.Application

xl.Workbooks.Open (strPath)

xl.Visible = True

Me.Close
End Sub

Change the constant at the top to reflect where your file is located.


On Sep 8, 1:28 am, Gerry O wrote:
Thanks, Jim. I know this works if you open the Excel file with the code
first. However, if a user already has a workbook open, opening this file
will open in the same instance as the existing workbook, rather than a new
instance. I am trying to get my workbook to always open in a new instance of
Excel and was hoping to find the code for it. Possibly need a shell file
that runs a macro to fire my workbook into a new instance? Not sure of the
coding though.
--
Thanks,

Gerry O.



"Jim Thomlinson" wrote:
Here is some code to make spreadsheets open up in new instances...


Application.IgnoreRemoteRequests = True
'Open your file
Application.IgnoreRemoteRequests = False


Note that what this is doing is it is toggling the setting
Tools|Options - General -Ignore Other Applications
--
HTH...


Jim Thomlinson


"Gerry O" wrote:


I have an Excel workbook that uses userforms and save/close procedures
extensively to automate some processes. I need this workbook to always open
in a new instance of Excel. If the user already has a workbook open, opening
this file will open in the instance that is already open, which I don't want.
Is there any VBA code that will force this to happen? Much appreciated!
--
Thanks,


Gerry O.- Hide quoted text -


- Show quoted text -