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

First of all I'd like to apologize for the late reply as I was already home and didn't have access to the computer I was working with. Thank you very much for the help. I did understand your explanation and the logic I used was flawed. My code would rename all components it found instead of just the necessary ones and this would conflict.  Keeping your advice in mind I have altered my code and it seems to be working correctly now. This is the working version below, one for the original piece and the other one for the mirrored version.

Dim oAsmDoc As AssemblyDocument
    oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
    oAsmDef = oAsmDoc.ComponentDefinition

Dim oOcc As ComponentOccurrence 
Dim i As Integer = 1

For Each oOcc In oAsmDef.Occurrences
	If oOcc.Type = ObjectTypeEnum.kComponentOccurrenceObject AndAlso oOcc.Name.StartsWith("99991000 - CBC - Zijwang 1.2_Weld:")
		oOcc.Name = "99991000 - CBC - Zijwang 1.2_Weld" & ":" & i
		i = i + 1
	End If
Next

And the MIR

Dim oAsmDoc As AssemblyDocument
    oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
    oAsmDef = oAsmDoc.ComponentDefinition

Dim oOcc As ComponentOccurrence 
Dim i As Integer = 1

For Each oOcc In oAsmDef.Occurrences
	If oOcc.Type = ObjectTypeEnum.kComponentOccurrenceObject AndAlso oOcc.Name.StartsWith("99991000 - CBC - Zijwang 1.2_Weld_MIR")
		oOcc.Name = "99991000 - CBC - Zijwang 1.2_Weld_MIR" & ":" & i
		i = i + 1
	End If
Next

 This numbers the components correctly.

correct.PNG