Message 1 of 6

Not applicable
04-21-2017
03:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How can I check if a part/assembly exists in an assembly using it's name. I thought this code would do the trick but it's not working.
I have a part in my assembly which contains the text P1 inside it's browser name but PartExists still returns 0.
Dim doc As AssemblyDocument doc = ThisDoc.Document Dim oComp As ComponentOccurrence Dim oComps As ComponentOccurrences oComps = doc.ComponentDefinition.Occurrences For Each oComp In oComps If oComp.Name.Contains("P1") Then PartExists = 1 Else PartExists = 0 End If Next MsgBox(PartExists)
Solved! Go to Solution.