It has something to do with how the XP launches a file associated with an
exe. If I click on or choose, open form the context menu in the file
explorer the workbook is loaded into the most recently launched instance of
Excel or if I launch the file alone form the command line it is put into the
most recently launched instance of Excel. If I launch Excel and then load
the file I get a separate instance of Excel or if I launce excel from the
command line with the file as a command line argument I get a second instance
of excel.
I know .NET launches a new instance of Excel because I can wind up with
several running. I can verify this by the tasks manager. I will have
several Excels running that I need to explicitly end them.
A quick check of Word and Visio; Visio is similar Excel and Word is
different. Word under the Windows menu you can see all the running documents
but closing there window only closes the one document.
--
Mike Reed
"Tushar Mehta" wrote:
Maybe, there is some option in XL that I have long since forgotten but
if not using CreateObject is SOP for starting a new instance of XL.
Another possibility is that .Net is doing something different.
One way to narrow down the source of the problem would be to
instantiate a new copy of XL from VB or from VBA running in another
Office program or from VBA running in XL itself. If VB/A works fine
then you can safely focus your attention on the .Net interface. If it
doesn't there's something about that machine / copy of XL.
One final note. You may want to ensure you have the latest support
release for your version of XL.
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article ,
am says...
Using create object did not work. I may be in the wrong group but this is
what I am doing.
I am opening an Excel workbook from a VB.NET program using:
_myApplaction = New Excel.Application
_myWorkbook = ._myApplaction.Workbooks.Open(ExcelWorkbookPath)
I also tried
_myApplaction = CreateObject("Excel.Application")
_myWorkbook = ._myApplaction.Workbooks.Open(ExcelWorkbookPath)
In both cases if I open a workbook file it uses the running Excel instance
you can see this by looking at the Windows menu, both files are listed there.
If I open Excel and then open the workbook, it is in a new instance in each
instance the Windows menu will only show one workbook.
Is there a way to tell excel to open a new instance when a workbook file is
opened, preferably programmability.