I want to set multi values from Excel named range. I tested and got the failure: "Array was not a one-dimensional array."
MultiValue.List("myP") = GoExcel.NamedRangeValue("MyRange")
Is there anything missed?
In Excel, the named range is a X*Y dimensions. X is the rows, Y is the column. While the parameter of multi-values in Inventor is one dimension. Even you defined the named range with only one column, it is not a correct usage to set it to the multi-values directly. You need to extract the values of the column we are interested in. e.g. the code below gets the values of the first column.
' this is an array X*Y dimension
rangeArray = GoExcel.NamedRangeValue("MyRange")
'create a list to get the values of the columns
Dim oList As ArrayList
oList = New ArrayList
'rangeArray.GetLength(0) means how many rows
'rangeArray.GetLength(1) means how many colmuns
oRowsCount = rangeArray.GetLength(0)
oColCount = rangeArray.GetLength(1)
Dim oRowIndex As Integer
Dim oColIndex As Integer
For oRowIndex = 1 To oRowsCount
' add value of each row one by one
For oColIndex = 1 To oColCount
'set it to the list parameter
MultiValue.List("MyP") = oList