Open Excel

  • Thread starter Thread starter MD
  • Start date Start date
M

MD

This code does not seem to work for me.

Sub NewExcelWindow()
Set objexcel = New Excel.Application
objexcel.Visible = True
End Sub

A) As soon as the sub ends, the new excel intance closes also.
B) It does not open a workbook inside the new excel intance.

Just like Application.ActivateMicrosoftApp xlMicrosoftWord but for a new
EXCEL intance. I'd like to open a new workbook on a new intance of EXCEL.

PS Why doesn't Application.ActivateMicrosoftApp xlMicrosoftEXCEL work??? It
works for Access, word etc...

Regards,

Michel
 
Have you dimmed "objexcel" as a module level variable? If not it's local
and goes out of existence when the sub ends.

--
Jim Rech
Excel MVP
|
|
| This code does not seem to work for me.
|
| Sub NewExcelWindow()
| Set objexcel = New Excel.Application
| objexcel.Visible = True
| End Sub
|
| A) As soon as the sub ends, the new excel intance closes also.
| B) It does not open a workbook inside the new excel intance.
|
| Just like Application.ActivateMicrosoftApp xlMicrosoftWord but for a new
| EXCEL intance. I'd like to open a new workbook on a new intance of EXCEL.
|
| PS Why doesn't Application.ActivateMicrosoftApp xlMicrosoftEXCEL work???
It
| works for Access, word etc...
|
| Regards,
|
| Michel
|
|
|
|
|
|
 
I have now :-)) ... Now the application (new instance of excel) stays
open.... How do I open a new workbook in that instance.?

thx,

Michel
 
Dim objexcel as Excel.Application

Sub RunXL
Set objexcel = New Excel.Application
objexcel.Workbooks.Open "C:\MyFile.xls"
objexcel.Visible = True
End Sub

--
Jim Rech
Excel MVP
|I have now :-)) ... Now the application (new instance of excel) stays
| open.... How do I open a new workbook in that instance.?
|
| thx,
|
| Michel
|
|
|
|
| "Jim Rech" <[email protected]> a écrit dans le message de
| | > Have you dimmed "objexcel" as a module level variable? If not it's
local
| > and goes out of existence when the sub ends.
| >
| > --
| > Jim Rech
| > Excel MVP
| > | > |
| > |
| > | This code does not seem to work for me.
| > |
| > | Sub NewExcelWindow()
| > | Set objexcel = New Excel.Application
| > | objexcel.Visible = True
| > | End Sub
| > |
| > | A) As soon as the sub ends, the new excel instance closes also.
| > | B) It does not open a workbook inside the new excel instance.
| > |
| > | Just like Application.ActivateMicrosoftApp xlMicrosoftWord but for a
new
| > | EXCEL instance. I'd like to open a new workbook on a new intance of
| EXCEL.
| > |
| > | PS Why doesn't Application.ActivateMicrosoftApp xlMicrosoftEXCEL
work???
| > It
| > | works for Access, word etc...
| > |
| > | Regards,
| > |
| > | Michel
| > |
| > |
| > |
| > |
| > |
| > |
| >
| >
|
|
 
Back
Top