View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jeremy Leigh Jeremy Leigh is offline
external usenet poster
 
Posts: 1
Default More about trying to automation multiple Excel instances

Hello Jialiang,

This is a very interesting thread, and I would like to revisit the research
here for the following reason -

I work in a corporation where users have many instances of excel running at
once.

I am also responsible for deploying an excel addin (.xla) to users machines.
Currently in order to deploy an updated version of the addin, all running
instances of excel must be closed.
However, it is also possibly to update the add-in without closing excel. The
way this can be done is to first unload the addin from all running instances
of Excel via Tools, Addins.
The old xla can then be overwritten with the new version, and the new add-in
can then be reloaded into excel via the Tools, Addins dialog by re-checking
the checkbox.

So what I want to do is create an auto-update macro. This macro would check
the current version of the installed XLA, and if it is out of date it would
do the following:

(1) Loop through all running instances of Excel.Application and,
(2) Uninstall the addin I am going to update using
Application.AddIns("myAddin").Installed = False
(3) Copy over the .xla file with the new version
(4) Loop through all running instances of Excel.Application and,
(5) Re-install the addin using Application.AddIns("myAddin").Installed = True

This is necessary because some workbooks in this banking environment take
15+ minutes to calculate, so closing excel for updating addins is extremely
inconvenient for users.

So obviously this looping would need to
(a) work with Excel Applications which have no open workbooks
(b) work with Excel Applications where the workbook has been opened more
than once - i.e. Read Only.
It is quite common for excel applications to be in one of the above states
on user machines.
Appreciate your advice on the matter.

Thanks,
Jeremy Leigh.

""Jialiang Ge [MSFT]"" wrote:

Hello Sergei,

I can understand your concern on the "potential issue" - several Excel
instances without opened books. Let's imagine the following three test
scenarios:

Test Scenario 1. When several Excel instances are started without opened
workbooks.
"Without opened workbooks" means no workbook (even the default "new"
workbook) is present in the instances, and Excel is in an empty, grayed
background. For such a scenario, I agree it is a potential menace in that
no file moniker is registered in ROT. I had also considered enumerating
excel process ID and attach Excel object model to the process, but it would
not work either due to the different "working mechanisms". The possible
workarounds depend on your specific product context. If I'm proper to be
told the detailed reason/context for the automation of Excel instances
without opened workbooks, I may be able to find out some workarounds for
your references.

Test Scenario 2. When several Excel instances are started with a default
open.
"A default open" means that, when Excel is started, it has a "new" workbook
open by default. The "new" workbook will be registered as file moniker in
ROT with names "Book1", "Book2", etc. Therefore, we are still able to
differentiate the Excel instances with the names "Book1", "Book2", etc in
this scenario.

Test Scenario 3. When several Excel instances open the same workbook
simultaneously
The first open of the workbook register the file moniker in ROT. The
following Excel instances can only open the book in the mode of
"read-only", and they will not register the file moniker again, thus,
querying the file moniker in ROT can merely return the first instance of
Excel. Will this scenario influence your product context?

I'm completely satisfied with the answers to both my questions! My
other needs doesn't concern to this particular issue, so I'm going to
submit it as separate posts.

Thank you for the positive feedback. Delighting you with my support
services is my goal. I'd also thank you for the feedback of "theoretical"
and "practical", I will demo more practices in my future supports for you.

Regarding the "other needs", please DON'T hesitate to tell me. I'm with you
and can serve you at your conveniences.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================