Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have some code that sets a couple iproperty values of assemblt components based on the components' File Name.
It produces the desired result, but runs way too slow since it is looking at every file in the assemblies referenced document set.
How can I modify this to only look at first-level assembly occurrences? My code pasted below:
'------------------------------------------------------------------------------------------------------'Set all CONFIGURED components in assembly to have designer initials as Author and Designer iPropertiesopenDoc = ThisDoc.Document docFile = ThisDoc.Document Dim docFName As String Dim FNamePos As Long comps = docFile.ComponentDefinition.Occurrences names = New List(Of String) For Each docFile In openDoc.AllReferencedDocuments 'Find position in full filename path string where component filename begins FNamePos = InStrRev(docFile.FullFileName, "\", - 1) 'Strip off filename path string and set docFName to just the component's file name docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) - FNamePos) 'Check if first 5 characters of docFName is equal to Job Number string: If Left(docFName,5) = Parameter("CONFIG FILE", "sJobNumber") Then iProperties.Value(docFName, "Project", "Designer") = Parameter("CONFIG FILE", "sDesignerInitials") iProperties.Value(docFName, "Summary", "Author") = Parameter("CONFIG FILE", "sDesignerInitials") Else 'MessageBox.Show(docFName, "Title") End If Next
I am sure it is a simple task: I just cant find an example of operating on filenames using the ComponentDefinition methods.
Thanks to anyone who can help!
James
Solved! Go to Solution.