How to set a new Excel instance as the 'default'

L

Lachlan Sharp

Is there a way I can make a new instance of Excel
the 'default' Excel process? I know how to get the window
handle of my new Excel instance, and I've tried using the
SetWindowPos api to change the window order, but that had
no effect.

I have written a program in Access 2000 which involves the
creation of a new instance of Excel. The program basically
runs as follows:
.. A new Excel application is opened invisible to the user
.. An Excel workbook is opened and edited
.. The edited worksheet is imported into another Access
database using the Transferspreadsheet method
.. The Excel workbook is closed without saving

The program works fine EXCEPT if an existing instance of
Excel is open before running my program; In which case
the 'Transferspreadsheet' method in Access (as best as I
can describe) uses the existing Excel process to try and
do the import of the worksheet. Because my 'new' instance
of Excel already has the workbook I'm trying to import
open for editing, the workbook will be opened read-only in
the EXISTING Excel instance, and subsequently imported
into Access in the pre-edited form.

I can work around this problem by changing the methodology
of my program, but I would still like to know if there is
a way I can make a new instance of Excel the 'default'
Excel process. Any help regarding this question would be
appreciated.

Regards

Lachlan Sharp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top