Unhandled Exception in Mso9.dll when Using XlCoerce with Excel 200

Y

Yegor

SYMPTOMS
When I use XlCoerce in a dynamic-link library (DLL) that is loaded by
Microsoft Excel 2000, the following error message appears “Unhandled
exception in EXCEL.EXE (MSO9.DLL): 0xC0000005: Access Violation.â€

CAUSE
I am developing an XLL in Microsoft C++ 6.0 for Excel 2000. In my design
Excel calls my XLL function. Excel crashes when I try to use “Excel4(
xlCoerce, …†in my XLL function to coerce a reference XLOPER (xltypeRef) that
refers to a two dimensional range that contains text and empty cells. Excel
crashes in two different ways: 1) right in xlCoerce function if the function
is called after I select the Excel cell with XLL function click F2 and ENTER,
2) when I return control from the XLL function back to Excel if XLL function
was called as the result of manually changed Excel cell that is input for the
XLL function.

I looked on Internet to see if anyone had the same problem but I did not
find anything. The closest I could find was:
1. Microsoft article “"Unhandled Exception in Mso97.dll" When Using XlCoerce
with Excel 97â€:
http://support.microsoft.com/kb/q166287/
But this article says that it applies to Excel 97 and was fixed in Excel 97
SR-1 but I am using Excel 2000 SP-3.
2. The second Microsoft article is “FIX: Excel 2000 May Fault in MSO9.DLL
When Calling an XLL Function that Takes an Array†because I do pass
xltypeMulti|xltypeNum array:
http://support.microsoft.com/default.aspx?scid=kb;en-us;304442
But again it is not exactly what I have. The article says that the crash
appears in the following condition: “When Excel prepares to call an XLL
function during a recalculation, Excel calculates all dependent cells that
are needed to produce the arguments to pass to the XLL function. If one of
the dependent cell values is changed by outside code (such as DDE or
Automation) after this calculation, but before the XLL function is called,
Excel must postpone the XLL call and again recalculate the dependent cellsâ€.
I do not have a calculation of dependent cells in my spreadsheet as described
above. All I have is one XLL function in the spreadsheet that takes 13
parameters and all input parameters are plain number, text or empty cells in
forms of individual cells and ranges.

Did anyone have the similar problem? What did you do?
Do you have any ideas on how to solve this? If there is no fix then I have
to write a function that will loop through the xltypeRef and retrieve each
cell value in a range individually – I hope it will work!
Thank you very much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top