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

Hi @Andrii_Humeniuk , 

I tried adapting the code so this would work for an idw-file but I am not succeeding in this. Could you help me out with this?

I used the code below.

Kind regards,

Cor

Sub main()
Dim oDrawing As DrawingDocument
oDrawing = ThisApplication.ActiveDocument
Dim oPath As String
oPath = "O:\Product Development\Inventor\Workspace\TEST_ILOGIC" 'Folder to save the drawings
Dim oView As DrawingView
Dim oDoc As Document
Dim oFactory As iPartFactory
For Each oView In oDrawing.ActiveSheet.DrawingViews
    oDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
    On Error GoTo trynext
    oFactory = oDoc.ComponentDefinition.iPartMember.ParentFactory
    Exit For
trynext:
Next
    If oFactory Is Nothing = False Then
    Dim oRow As iPartTableRow
    
    For Each oRow In oFactory.TableRows
        For Each oView In oDrawing.ActiveSheet.DrawingViews
        On Error GoTo nextView
        If oView.ActiveMemberName <> oRow.MemberName Then oView.ActiveMemberName = oRow.MemberName
        Call oDrawing.Update
        Do While oView.IsUpdateComplete = False
            Call ThisApplication.UserInterfaceManager.DoEvents
        Loop
nextView:
    Next
    Call oDrawing.SaveAs(oPath & "\" & oRow.MemberName & ".idw", True)
Next
End If
End Sub