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

I've tried your code, although I modified it a bit in order to use it in VBA.

However the error still appears in the same line, so it seems that it doesn't the problem.

This is the first part of your code:

 

Sub Main()

Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

Dim oOccs As ComponentOccurrences
Set oOccs = oAsmDoc.ComponentDefinition.Occurrences
Dim oOcc As ComponentOccurrence

For Each oOcc In oOccs
'If it's not an Assembly, don't process it
If Not oOcc.DefinitionDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
'If it's not Purchased, don't process it
If Not oOcc.BOMStructure <> BOMStructureEnum.kPurchasedBOMStructure Then
If Not oOcc.DisabledActionTypes = ActionTypeEnum.kRestructureAction Then
If Not oOcc.Suppressed Or oOcc.Enabled = False Then
StepDown (oOcc.Definition.Occurrences)
End If
Next
End Sub