[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Opening another instance of Excel

theSquirrel

12/15/2006 7:57:00 PM

I have a program where I have require a button to open an additional
instance of Excel not just another window within the same instance.

Here is the code I have currently:

'Set variables for document location
ServerLoc = txtMasterServerLoc.Value
Filename = txtMasterFileName.Value

'check to see if the ServerLoc has a '\' at the end and add it if
not
If Right$(ServerLoc, 1) = "\" Then
docloc = ServerLoc & Filename
Else
docloc = ServerLoc & "\" & Filename
End If

'Open the Master Checklist
Workbooks.Open Filename:=docloc

However this doesn't work to open a new instance, it just opens the
document in the same instance of Excel.

Although this isn't a critical fix for this application, i have users
crying that its inconvenient. Love that!!

Thanks guys

1 Answer

theSquirrel

12/15/2006 8:46:00 PM

0

WOOT!! thanks, that worked perfectly

'Begin Creating the new Excel Window Objects
Dim xlApp As Object
Set xlApp = CreateObject("excel.application")

'make sure the new Excel window is visible
xlApp.Visible = True

'Open the Master Checklist
xlApp.Workbooks.Open Filename:=docloc

'release the object reference
Set xlApp = Nothing

Thanks Tom

On Dec 15, 12:14 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
wrote:
> Look in Excel VBA help at CreateObject
>
> --
> Regards,
> Tom Ogilvy
>
>
>
> "thesquir...@gmail.com" wrote:
> > I have a program where I have require a button to open an additional
> > instance of Excel not just another window within the same instance.
>
> > Here is the code I have currently:
>
> > 'Set variables for document location
> > ServerLoc = txtMasterServerLoc.Value
> > Filename = txtMasterFileName.Value
>
> > 'check to see if the ServerLoc has a '\' at the end and add it if
> > not
> > If Right$(ServerLoc, 1) = "\" Then
> > docloc = ServerLoc & Filename
> > Else
> > docloc = ServerLoc & "\" & Filename
> > End If
>
> > 'Open the Master Checklist
> > Workbooks.Open Filename:=docloc
>
> > However this doesn't work to open a new instance, it just opens the
> > document in the same instance of Excel.
>
> > Although this isn't a critical fix for this application, i have users
> > crying that its inconvenient. Love that!!
>
> > Thanks guys- Hide quoted text -- Show quoted text -