10-08-2022
02:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-08-2022
02:48 PM
I fingered it out. Thanks for the views. The following code will ask for a prefix string then loop through the existing user parameters and rename them. I will work on the if existed at a later time
Dim i As Integer Dim oTempString As String Dim oDoc As PartDocument = ThisDoc.Document Dim InputPrefix As String Dim myparam As String Dim NewName As String If oDoc.DocumentType = kPartDocumentObject Then Dim oPartCompDef As PartComponentDefinition = oDoc.ComponentDefinition myparam = InputBox("Enter Prefix", "Prefix", InputPrefix) Try For i = 1 To oPartCompDef.Parameters.UserParameters.Count oTempString = oPartCompDef.Parameters.UserParameters(i).Name NewName =myparam & "-" & oTempString oPartCompDef.Parameters.UserParameters(i).Name = NewName MsgBox(NewName) Next i Catch MsgBox("Parameter " & oPartCompDef.Parameters.UserParameters(i).Name & " could not be renamed to " & myparam & oTempString & vbCrLf & "Please check results.", MsgBoxStyle.Critical,"Rename User Parameters") End Try End If