Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Change iPart member

Hubert_Los
Advocate

Change iPart member

Hubert_Los
Advocate
Advocate

Hello,  

 

I am trying to change an iPart member in VBA, but I don't know how to use "ChangeRow" function.

Sub iPartsChangeRow()

    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oAssemblyComponent As AssemblyComponentDefinition
    Set oAssemblyComponent = oDoc.ComponentDefinition
    
    

    Dim oComponentOccurrenceToChange As ComponentOccurrence
    Set oComponentOccurrenceToChange = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Wybierz element do zmiany")
    
    Dim oIPartMember As iPartMember
    Set oIPartMember = oComponentOccurrenceToChange.Definition.iPartMember
    
    Dim oFactory As iPartFactory
    Set oFactory = oIPartMember.ParentFactory

    Dim oPartIdentifier As String
    oPartIdentifier = oFactory.TableRows.Item(5).PartIdentifier
  
    oIPartMember.ChangeRow (oPartIdentifier)

End Sub

 

 

0 Likes
Reply
Accepted solutions (1)
320 Views
1 Reply
Reply (1)

A.Acheson
Mentor
Mentor
Accepted solution

There is a dedicated method from component occurrence. See API help page and article showing the method. 

Syntax

ComponentOccurrence.ChangeRowOfiPartMemberNewRow As Variant, [CustomInput] As Variant )

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes