Hi,
From you description, I understand that you want to run a winform
application with embedded Excel Object. And in the meantime, you will have
an Excel Application running.
Now if we launch the Winform Forms application first and then launch the
Excel, all is OK.[Secenario A]
But if now we launch the Excel Application first, and then the Winform
Application later, the Excel Application will not reponse to user's
interation.[Scenario B]
If I misunderstood, please feel free to let me know.
Firstly I would like to know what is the Excel Object Embedded in the
Winform. Did you host a WebBrowser in Winform and then open a Excel
Workbook in the WebBrowser? Or how did you embed the Excel Object into
winform.
Based on my experience, I wonder this may be caused by that there is only
one Excel process in the problem case[Scenario B].
You may try to check how many Excel.exe process in both Scenario A and B
with Task Manager.
1. Press Ctrl+Shift+ESC, the Task Manager will open
2. Press the Processes Tab, check how many Excel.exe process exist in
Scerario A and B.
You may have a try and let me know the result.
If the above assumption is the case, please let me know how you embedded
the Excel Object into Winform to see if there is any workaround.
But based on my knowlege, it is hard to control that, this is all done by
OLE.
If you still have any concern, please feel free to let me know.
I look forward to hearing from you.
Best regards,
Peter Huang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
jpl - 15 Sep 2006 10:10 GMT
Hi Peter,
Yes, the winform application hosts a WebBrowser and opens a Excel
Workbook in the WebBrowser. The app works for Excel 2002 and 2003. I don't
have a test environment to try out 2000.
You are right. The scenario A runs 2 Excel processes and the scenario B runs
1 process. Do you think the reason Excel app does not respond to user's
interaction in scenario B is because winform app takes over the Excel
control? you implied in your last email that this may be to do with OLE
control. If that is the case, why there is no lock up scenario for Office
apps when a Excel object is embedded inside of MS Word app or IE browser.
I use VS 2005 WebBrowser control and place this control in a TabControlled
Form. The program is able to access Excel.Application and Workbook in the
brower callback handler after WebBrowser.Navigate(urlName, newWindow) is
called (newWindow is false).
Once the program has Excel.App and Workbook, everything is pretty
straightforward from there. We disable all user interactions with this
embedded Excel and replace them with our own controls. But I don't think this
disablement causes any problem for scenario B.
I am not sure above description is detail enough. Let me know if you need
further explanation.
Thanks,

Signature
- jpl -
> Hi,
>
[quoted text clipped - 41 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 18 Sep 2006 12:11 GMT
Hi,
Thanks for your information.
So far I am trying to reproduce your scenario.
Common to use Office application, we have three approaches.
1. Start it direct
2. By OLE, just as you do or open it in a WebBrowser ..... This is the OLE
behavior I means in last reply.
3. Automation, use code to launch and utilize the Office application.
Because Office application mainly works as STA which is a COM term, we can
consider it as Single Thread.
So it may not work correct when many application attach to the same Office
product.
So far I am still researching the issue and I will update you with new
information ASAP.
Best regards,
Peter Huang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
jpl - 19 Sep 2006 00:51 GMT
Thanks, Peter
One thing I don't understand is why Office Apps (Excel, Word, PPT, etc.) can
interact nicely together (do not lock each other up). Maybe there is a way
that we (or I) don't know about that can direct Excel.exe to run as a
standalone copy or multi-threaded server.
FYI, I just tried running Excel before running an IE 6 or 7 with embedded
Excel. When I looked at the task manager, I saw only one copy of Excel.exe
running and both programs have no problem interacting with user (me in this
case).
Look forward to seeing what you come up with.
Best regards,

Signature
- jpl -
> Hi,
>
[quoted text clipped - 25 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 19 Sep 2006 06:15 GMT
Hi,
I am sorry I did not make it more clear.
I just wonder this problem may be caused by that the Excel application and
the WebBrowser running in the same process.
So I am doing some test and performing research.
Based on my research, as you said, the problem did not occur when you open
the excel file in IE application.
But I make a simple a test that host the unmanaged WebBrowser control(the
NET webbrowser control is a wrapper) on the VB6 form, but the problem
persists.
So I think the problem is at the WebBrowser itself.
So far I am performing further researching.
Also I would like to collect more private information from you, could you
let me know your Email address?
You may just send a Email to me via removing "online" from my Email address
and I will get your Email Address.
Thanks!
Best regards,
Peter Huang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.