Problem with Addin in Microsoft Excel

Add-in Express™ Support Service
That's what is more important than anything else

Problem with Addin in Microsoft Excel
Excel crashes when opening documents 
Michael McMahon




Posts: 56
Joined: 2005-05-03
Hi there,

I'm having an issue with our addin where Excel crashes when I open a document. The message that the users sees is:

User added an image

The strange thing about this is that it doesn't happen all the time. When it does happen it doesn't seem to affect the operation of the addin (i.e. the addin works as expected).

So far I've tried commenting out certain sections of the startup code to try to isolate the problem and have put fairly extensive debug writes throughout the code but this hasn't shed any light on the subject so I thought I'd ask if any one else has had similar issues and if so I'd be interested to know how you solved them.

The complete source code along with an installation package for our addin is available here: http://opd.globalx.com.au/download/OfficeAddIn.zip

If you have a chance to look at this to offer suggestions that would be greatly appreciated.


Michael McMahon
Posted 01 Jun, 2006 23:43:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Michael.

Ok, I will look at the code.
Posted 02 Jun, 2006 06:20:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Michael, I haven't managed to reproduce this issue on my PC. The InitialiseAgent function always returns False. Probably the cause of the issue is in this function. What should I do to get the InitialiseAgent function working properly?
Posted 03 Jun, 2006 19:52:55 Top
Michael McMahon




Posts: 56
Joined: 2005-05-03
Hi Sergey,

The InitialiseAgent function fails when the ActiveX component that it instantiates is not registered. The ActiveX component is installed/registered by the MSI installer in the setup for the office addin. I would recommend using this to register the component as it in turn has other components which should be registered to ensure it functions properly. If you want to deploy it by itself simply run the opdp_ca.exe file and it should register itself automatically.

Regards,


Mike
Posted 04 Jun, 2006 20:15:17 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Michael.

Unfortunately I didn't manage to get the InitialiseAgent function working.

I tested the msi installer. The add-in was loaded without any errors in Excel.
Posted 06 Jun, 2006 07:09:05 Top
Michael McMahon




Posts: 56
Joined: 2005-05-03
Hi Sergey,

Did you try running the project in code after using the MSI installer? Cause the InitialiseAgent function should work fine after you've done that.


Mike
Posted 06 Jun, 2006 17:58:38 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Yes, I did.
Then I tested it in the debugger and the InitialiseAgent function returned False.
Posted 07 Jun, 2006 07:02:54 Top
Michael McMahon




Posts: 56
Joined: 2005-05-03
Hi Sergey,

Are you able to debug it once more and print Err.Description after this line:

mWebdocs = New interop.OPDP_CA.clsWebdocs

I'd like to know what the error message is when it fails.

Thanks in advance,


Michael McMahon
Posted 12 Jun, 2006 22:02:18 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Michael.

I get the following error:
"COM Object with CLSID {DF21E44A-7FAA-4681-B264-480CAF56AAC1} is either not valid or not registered."
Posted 13 Jun, 2006 14:38:47 Top
Michael McMahon




Posts: 56
Joined: 2005-05-03
Hi Sergey,

This obviously means that the COM+ component which is installed by our MSI isn't being registered on your machine for some reason. This is very unusual but I'm going to ignore this issue for now and just accept that it means that you can't debug our addin on your machine.

On a separate point, I have noticed that "the issue" described in the first post to this topic doesn't happpen with Office 2003 without any service packs. It only happens when you install SP2 for MS Office. Which I find quite bizarre.

I've spent some time trying to work out what updates in Office 2003 SP2 could have caused this but I'm still now quite sure. If any one has any thoughts on that please let me know.

A bit more specific info from the error log that our addin writes to:

-------------------------------------------------
Msg: ObjExcelEvents_WorkbookBeforeClose Err:
Date: 13/06/2006 12:26:16 PM
ErrNum: 5
ErrDesc: COM object that has been separated from its underlying RCW can not be used.
-------------------------------------------------

What we do in this function is get the count of the workbooks that are open in Excel and then have a look at each one to see if custom document properties are set that tell us if the doc is checked out in our web based DMS. If it is then we check user options to see if we should check the doc back in, etc...

I suspect what's happening is, because Excel is normally shutting down when this happens, the Workbook objects are being disposed of before our function has a chance to finish. I still don't know how to resolve the problem but I think that's the source of it.


Mike
Posted 13 Jun, 2006 20:40:41 Top