Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2006

Tip: Looking for answers? Try searching our database.

Multiple WebBrowser controls with multiple Excel files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JLB - 18 Sep 2006 18:09 GMT
I'm writing an MDI app in VS2005 to interop with Excel 2000.  I want to
provide the user with the ability to view and interact with multiple excel
files, each being displayed in its own child window/WebBrowser control.  The
problem I am having is that when the second excel file is opened in its
respective window/WebBrowser, the window for the first excel file seems to
lose association to the excel application, and strange things start to happen
(for instance, clicking on a worksheet tab causes the sheet to be deleted,
cannot select a cell or enter data).

Is what I want to do possible?

Thanks in advance.
jpl - 19 Sep 2006 05:28 GMT
Hi,

I don't know about Excel 2000. But I know it's not possible for Excel 2002
and 2003. My guess is it won't work for 2000 either.

Regards,

Signature

- jpl -

> I'm writing an MDI app in VS2005 to interop with Excel 2000.  I want to
> provide the user with the ability to view and interact with multiple excel
[quoted text clipped - 8 lines]
>
> Thanks in advance.
JLB - 19 Sep 2006 13:14 GMT
Can you (or anyone else) explain why it won't work?

Thanks,

JLB

> Hi,
>
> I don't know about Excel 2000. But I know it's not possible for Excel 2002
> and 2003. My guess is it won't work for 2000 either.
>
> Regards,
jpl - 21 Sep 2006 01:53 GMT
I don't know what happening internally. I can only speculate. There can only
be a single Excel object embedding (OLE) active or visible to Excel in your
application at a time. When I say "visible to" Excel, I mean "assign to"
Excel. When a new Excel OLE is created, the reference to the previous one
from Excel is replaced and no longer there to reconnect. This is what you
start seeing strange things on the first excel ole. Based on this behaviour,
I suggest you work with this limitation instead of fighting again it. You can
still achieve what you want if you are willing to modity your design.

What you need to do is to delete the excel ole and recreate it when user
switch back from other window. It's ugly but it works. If you have a lot of
excel ole windows that need to jump back and forth, you might want to
consider other architecture options.

Signature

- jpl -

> Can you (or anyone else) explain why it won't work?
>
[quoted text clipped - 8 lines]
> >
> > Regards,
JLB - 21 Sep 2006 13:33 GMT
Thanks for your reply, jpl.

Your explanation is certainly what I have been suspecting, but what I don't
understand is that Internet Explorer does not behave in the way you and I are
seeing the WebBrowser control behave.  You can open multiple excel files in
multiple IE windows and switch between them with no problems.  The active IE
window seems to pull the Excel "focus" to it.  You can even double-click
*.xls files and they will open in the actual Excel Application (using the
same instance as the 2 IE displayed files), another impossiblity when using
the WebBrowser ctrl.  This tells me that the code under the WebBrowser
control is not exactly the same code that IE uses; it may be a part of it,
but it is not all of it.

(As a side note, WebBrowser does not have the same problem with Word files.)

As for your suggested workaround, you took the thoughts right out of my
head.  I'm too pressed for time to consider a redesign, so hopefully the
users won't mind the ugliness that will ensue...

Regards.

> I don't know what happening internally. I can only speculate. There can only
> be a single Excel object embedding (OLE) active or visible to Excel in your
[quoted text clipped - 22 lines]
> > >
> > > Regards,

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.