It would turn out that the approach that I was taking to bind the
Excel window to the .NET panel will not behave properly for Excel and
in general, Office applications.

To bind an Office application to a .NET form, it's better to use
DSOFramer - a Microsoft provided ActiveX component that hosts office
applications. As it is ActiveX, to use it on a WinForms form. Simply
install the library, and add it via COM (DSOFramer becomes a
registered COM component)...

What it does mean is that DSOFramer.ocx does need to be registered in
the registry.

Her's a link...
http://support.microsoft.com/kb/311765

On 4/4/07, Matthew Wills <[EMAIL PROTECTED]> wrote:
Jason,

Show us some of your code.

Seeya
Matthew Wills | Senior Analyst Programmer / Solution Designer | Adviser
Tools and Services | Financial Planning and Third Party | NAB Technology

Phone: 02 9957 8183 | Mobile: N/A | Email: [EMAIL PROTECTED]



|---------+---------------------------->
|         |           Jason            |
|         |           <[EMAIL PROTECTED]|
|         |           COM>             |
|         |                            |
|         |                            |
|---------+---------------------------->
  
>------------------------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                                 |
  |       To:       ADVANCED-DOTNET@DISCUSS.DEVELOP.COM                         
                                                 |
  |       cc:                                                                   
                                                 |
  |       Subject:  [ADVANCED-DOTNET] Excel interop strange behaviour           
                                                 |
  
>------------------------------------------------------------------------------------------------------------------------------|




Howdy All,

Hit an Excel snag...

I'm using the PIA to interface with Excel. There are two problems that I'm
facing...
1. Upon showing the excel application, the mouse doesn't seem to respond to
the application (ie. you
can't scroll or click on cells, or change tabs). You can use the mouse
AFTER you start typing... and at
that point, excel thinks you're making a change to the currently
highlighted cell. Is there a way to
'activate' and force focus on a cell so mouse events are routed directly to
excel? (I think i've tried
everything... that seemed obvious). I'm pretty sure that the excel
application also has focus.

2. When I invoke the Quit method... sometimes excel crashes and displays
the usual excel crash
dialog (with buttons to send the error to microsoft). This is intermittent,
and I don't really know what
I'm doing wrong here. I'm releasing every single COM object that I have ...
or at least I think I am... is
there a way to diagnose what's going on here? I close every workbook and
then quit excel... but
nothing I do seems to help. Is there a way to make exiting excel robust?

Note that excel is hosted on a .NET form. Attaching the excel window to the
.NET panel is done using
native calls via the user32.dll (FindWindow, SetParent and sizing is done
via SetWindowPos and
MoveWindow)




National Australia Bank Ltd - ABN 12 004 044 937
This email may contain confidential information. If you are not the intended recipient, 
please immediately notify us at [EMAIL PROTECTED] or by replying to the sender, and then 
destroy all copies of this email. Except where this email indicates otherwise, views 
expressed in this email are those of the sender and not of National Australia Bank Ltd. 
Advice in this email does not take account of your objectives, financial situation, or 
needs. It is important for you to consider these matters and, if the e-mail refers to a 
product(s), you should read the relevant Product Disclosure Statement(s)/other disclosure 
document(s) before making any decisions. If you do not want email marketing from us in 
future, forward this email with "unsubscribe" in the subject line to [EMAIL 
PROTECTED] in order to stop marketing emails from this sender. National Australia Bank 
Ltd does not represent that this email is free of errors, viruses or interference.

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com



--
Cheers,
Jason

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to