XLL Module Range Argument Error in a Function

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

XLL Module Range Argument Error in a Function
XLL Module Range Argument Error in a Function 
bangush




Posts: 10
Joined: 2011-12-27
When adding Excel.Range in the Function Argument. Then It give me error.

MyAddin1.XLLModule1 error: the XLL add-in has fired an exception.
Unknown Data Type: Excel.Range
Posted 25 Feb, 2012 05:26:34 Top
Eugene Astafiev


Guest


Hi Adil,

Please take a look at the http://msdn.microsoft.com/en-us/library/bb687869.aspx article in MSDN. Available data types are listed in the spreadsheet.
Posted 25 Feb, 2012 06:47:03 Top
bangush




Posts: 10
Joined: 2011-12-27
i. Use defensive Programming.
ii. Use Object in the Arguments of the Function. Object get any type in dotnet.
iii. Define variable of type ADXExcelRef.
iv. Set variable to Object.
v. the function demonstrate this is:

Public Shared Function Sequence(ByVal arg As Object) As String

Dim str As String = vbNullString
Dim rng As ADXExcelRef

Dim TopColumnValue As String = vbNullString
Dim TopLeftColumnValue As String = vbNullString
Dim CurrentColumnVAlue As String = vbNullString

Try

If TypeOf arg Is ADXExcelRef Then

rng = CType(arg, ADXExcelRef)

If rng IsNot Nothing Then

... TO DO...


End If

End If

Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try

Return str

End Function
Posted 25 Feb, 2012 06:47:29 Top
bangush




Posts: 10
Joined: 2011-12-27
i solve the problem. thanks Eugene Astafiev.
Posted 25 Feb, 2012 06:49:40 Top
Eugene Astafiev


Guest


You are welcome, Adil! ;-)
Posted 25 Feb, 2012 06:53:10 Top