Hi,
I am building an Excel automation Add-In function using C#.
(Excel 2003, Windows XP, Visual Studio.NET 2003).
My function has the following form:
public decimal function1( int param1, int param2 );
What if I want to return an ERROR to Excel ?
How is error handling performed ?
My function returns a decimal, so I cannot return the error message as the
return value...
Please help
Thanks
Emmanuel
"Peter Huang" [MSFT] - 14 Dec 2004 08:26 GMT
Hi,
Now I am researching the issue and we will reply here with more information
as soon as possible.
If you have any more concerns on it, please feel free to post here.
Thanks for your understanding!
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 16 Dec 2004 03:18 GMT
Hi
So far I am keeping researching the issue, and I will get back here and
reply to you ASAP.
Best regards,
Perter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 17 Dec 2004 06:19 GMT
Hi
So far I am contacting relative supporting Team, and we will reply to you
ASAP.
Thanks for your understanding!
Best regards,
Perter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 21 Dec 2004 06:16 GMT
Hi
So far we are still researching the issue sorry for the delayed response.
We will reply to you ASAP.
Thanks for your patient.
Best regards,
Perter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 23 Dec 2004 08:31 GMT
Hi
I am sorry for delay result.
After we did further detailed troubleshooting, it seems that the Excel use
a different error handle mechanism.
So far to do the job, we need to manual wrap the COM hresult error manually.
We can return the error as below.
public object f()
{
//return #DIV/0! to excel
return new ErrorWrapper(unchecked((int)0x800a07d7)); // this will cause
the #DIV/0! error in the Excel.
}
Following are the HRESULT for the VT_ERROR:
#NULL! 0x800a07d0
#DIV/0! 0x800a07d7
#VALUE! 0x800a07df
#REF! 0x800a07e7
#NAME? 0x800a07ed
#NUM! 0x800a07f4
#N/A 0x800a07fa
If you still have any concern, please feel free to post here.
Best regards,
Perter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Emmanuel - 23 Dec 2004 09:39 GMT
Thanks Peter.
> Hi
>
[quoted text clipped - 31 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.