Hi @mgrenier2. This is essentially the same general idea that @Frederick_Law suggested, but maybe a little more specific. There is an Inventor API object that is often really good for these types of situations, called a NameValueMap. This is a transient object used for transferring one or more Name & Value pairs of data. Each entry in it has a 'Name' (always a String), and a Value (an Object - can hold different data types or object types). To use one of these, you have to create one with the TransientObjects.CreateNameValueMap method, and set the object it creates as the value of a NameValueMap type variable. Then you can use that variable to add entries into it. Then you can pass that variable to another method (Sub or Function) as one of its 'input' values (as long as that method is designed to accept one). Then, once you have that object in the other method, you can access all the entries within it inside that method's block of code.
Below is a quickie, partial example of how it could be used.
Sub Main
Dim oMap As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oMap.Add("EntryName", "EntryValue")
oMap.Add("RowIndex", 3)
oMap.Add("PartsList", oMyPartsListObject)
oMap.Add("Document", oMyInventorDocumentObject)
oMap.Add("BooleanName", True)
'call the other method to run, and supply this NameValueMap to it as 'input'
ExportExcel(oMap)
End Sub
Sub ExportExcel(ByRef DataForExport As Inventor.NameValueMap)
Dim oDoc As Inventor.Document = Nothing
Dim oPList As Inventor.PartsList = Nothing
Dim iRow As Integer = 0
'make sure something was pass in, and make sure the expected entries are present
If DataForExport.Count > 0 Then
For i As Integer = 1 To DataForExport.Count
Dim sEntryName As String = DataForExport.Name(i)
Dim oEntryValue As Object = DataForExport.Value(sEntryName)
If sEntryName = "Document" Then
oDoc = oEntryValue
ElseIf sEntryName = "PartsList" Then
oPList = oEntryValue
ElseIf sEntryName = "RowIndex" Then
iRow = oEntryValue
'and so on...
End If
Next 'i
'use the recieved data as needed
'more code...
End If
'or, just do this directly, to get the value, if you are sure it is there
'Dim oDoc As Inventor.Document = DataForExport.Value("Document")
End Sub
Wesley Crihfield

(Not an Autodesk Employee)