Excel Addin in VB.NET 2k3 - how to return #N/A
- From: "." <personne@xxxxxxxxxxx>
- Date: Sun, 4 Sep 2005 19:54:27 +0200
Hi,
I just created a UDF in VB.Net say
Function GetTextOnly(TextOnly as object) as object
' =GetTextOnly("AnyString")
If TextOnly.GetType.Equals(Gettype(String)) then Return "This is a String"
' =GetTextOnly(A1) and A1 set to AnyString
Dim RefValue as object = Ctype(TextOnly,excel.range).value
If RefValue.GetType.Equals(Gettype(String)) then Return "This is a range
containing a String"
End Function
I've done some testing on that function in Excel A2 ie
Function return as expected
A2
Function Return
=GetTextOnly("AnyString") This is a String
=GetTextOnly(A1) and A1 set to AnyString This is a range containing a
String
Function return as not expected
=GetTextOnly(A1) and A1 set to nothing #Value
=GetTextOnly(A1) and A1 set to 123 0
In fact, I want my UDF to return #N/A (as a real Excel error) ie not a
string "#N/A" but the correct Excel constant #N/A (-2146826246)
Thanks for your help
.
- Follow-Ups:
- Re: Excel Addin in VB.NET 2k3 - how to return #N/A
- From: .
- Re: Excel Addin in VB.NET 2k3 - how to return #N/A
- From: Dr. Stephan Kassanke
- Re: Excel Addin in VB.NET 2k3 - how to return #N/A
- Prev by Date: RE: OLE object - bitmap representation?
- Next by Date: Re: Excel Addin in VB.NET 2k3 - how to return #N/A
- Previous by thread: ATL Word event sink for save function
- Next by thread: Re: Excel Addin in VB.NET 2k3 - how to return #N/A
- Index(es):
Relevant Pages
|