Hi @JhoelForshav
I have example below: I use excel vba file connect to Inventor to input value.
When I setup item type below on inventor:
Item A is Text
Item B is Number
Item C is Text
Item D is Date
And then I input data from excel same type, but all type that I was setup on Inventor change into Text.
I don't know what went wrong in my code.
If you know, please help me with this code.
Sub GetProperties()
Dim oWkbk As Workbook
Set oWkbk = ThisWorkbook
Dim oSheet As Worksheet
Set oSheet = oWkbk.ActiveSheet
Dim sSheetName As String
sSheetName = "Sheet1"
Dim sParamRange As String
sParamRange = "A1:A6"
Dim oInvApp As Inventor.Application
Set oInvApp = GetObject(, "Inventor.Application")
Dim oDoc As Document
Set oDoc = oInvApp.ActiveDocument
Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
Dim oPropSet As PropertySet
Set oPropSet = oPropsets.Item("Inventor User Defined Properties")
Dim oCell As Range
' Loop through each parameter listed in sheet
For Each oCell In oSheet.Range(sParamRange)
' Parse through parameters and check to see if parameter name matches current parameter from Excel
Dim oProp As Property
For Each oProp In oPropSet
' If names match, copy value and units from Excel into parameter expression
If oCell.Value = oProp.Name Then
oProp.Expression = oCell.Offset(0, 1).Value
End If
Next oProp
Next oCell
Set oExcel = Nothing
' Update part/assembly
oDoc.Update
End Sub