Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 349
Default excel interop: identifying when excel has "initialized"

This is a question about Excel interop. Any insight would be appreciated.

Question:

Is there any way (ie. event, property, hack, etc) to know when Excel has
initialized? I know this is probably not well-defined, but I would define it
as "all addins for the particular Excel process have initialized" since that
is most useful to my situation.

I have looked at a number of the interop capabilities (properties, events,
etc), nothing i have tried works though.

Background:

We are writing a program in .Net 1.1 using C# that targets the Excel 2000
Interop assemblies, but is being tested with Excel 2003 application which has
some 3rd party addins installed.

We have observed:

1) when "new Excel.ApplicationClass()" is used to start a new Excel process,
the addins do not properly initialize.

2) when starting a new Excel process using Process.Start(), the addins
initialize properly if I wait long enough (eg. sleep for 10 seconds to give
them time)

2.1) if I do not wait long enough, race-condition results occur, and the
addins do not initialize. other side effects (multiple excel processes, error
dialogs) also occur depending on situation, number of addins, etc.

2.2) "waiting long enough" is not well-defined since it is unknown the addin
configuration of a given client. also addins can raise dialogs on load which
require user feedback to complete.

Once again, any insight would be appreciated. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default excel interop: identifying when excel has "initialized"

Peter,
I can't answer your question for .Net, but from VB6:
Dim XLApp as Excel.Application
Set XLApp=New Excel.Application
XLApp.Workbooks.Add

The last line cannot execute until the Excel instance is up and running.

Excel 2003 (or maybe 2002) has an Application.Ready property that you can
may be check. It is supposed to indicate if Excel can respond. However, if
it cannot respond, I don't know how it is supposed to return the value of
this property. It apparently always returns True, which makes sense as it
would be illogical to return False.

Dim XLApp As Excel.Application

Private Sub Form_Load()
Dim i As Long
Dim InstalledCount As Long

Set XLApp = New Excel.Application

With XLApp
For i = 1 To .AddIns.Count
If .AddIns(i).Installed = True Then
InstalledCount = InstalledCount + 1
End If
Next
MsgBox "There are " & InstalledCount & " addins installed"
.Visible = True
'.Quit
End With

End Sub

So I would assume your problems are thread related and/or the way .Net
instantiates objects compared to VB.

NickHK

"Peter" wrote in message
...
This is a question about Excel interop. Any insight would be appreciated.

Question:

Is there any way (ie. event, property, hack, etc) to know when Excel has
initialized? I know this is probably not well-defined, but I would define

it
as "all addins for the particular Excel process have initialized" since

that
is most useful to my situation.

I have looked at a number of the interop capabilities (properties, events,
etc), nothing i have tried works though.

Background:

We are writing a program in .Net 1.1 using C# that targets the Excel 2000
Interop assemblies, but is being tested with Excel 2003 application which

has
some 3rd party addins installed.

We have observed:

1) when "new Excel.ApplicationClass()" is used to start a new Excel

process,
the addins do not properly initialize.

2) when starting a new Excel process using Process.Start(), the addins
initialize properly if I wait long enough (eg. sleep for 10 seconds to

give
them time)

2.1) if I do not wait long enough, race-condition results occur, and the
addins do not initialize. other side effects (multiple excel processes,

error
dialogs) also occur depending on situation, number of addins, etc.

2.2) "waiting long enough" is not well-defined since it is unknown the

addin
configuration of a given client. also addins can raise dialogs on load

which
require user feedback to complete.

Once again, any insight would be appreciated. Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
Problem with "For each" loop using .NET Interop and Excel Juan Pablo González Excel Programming 0 May 27th 04 06:00 PM


All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"