Passing SafeArrays in Visual Basic for Applications
Passing array data to SOLIDWORKS in Visual Basic for Applications (VBA) requires the use of
a VARIANT variable to hold the data. Put the data into an array and assign
a VARIANT to the array. The VARIANT is passed to an API function enclosed
within parentheses.
Dim varArray As Variant
Dim DataArray(9) As double
‘ Assign values
DataArray(0) = 0.1
...
‘ Pass the data to SOLIDWORKS
varArray = DataArray
Result = Object.Method( (varArray) ) ‘
The extra parentheses are required