Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here's an iLogic code that modifying sheet name automatically "<Part Number> <Stock Number>".
For example, Part number is "BS100" , Stock Number is "Shaft" then sheet name changed as BS100 Shaft.
This is my code below. There's an error but I couldn't check it and fix it.
Sub Main() ModifySheetName() End Sub Sub ModifySheetName() ' Get the active drawing document. Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument ' Check if it's a drawing document. If oDrawDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then MsgBox("This rule is intended to be used with drawing documents only.", MsgBoxStyle.Information) Exit Sub End If ' Get the part number and stock number from iProperties. Dim partNumber As String = iProperties.Value("Project", "Part Number") Dim stockNumber As String = iProperties.Value("Project", "Stock Number") ' Modify the sheet name. For Each oSheet As Sheet In oDrawDoc.Sheets If oSheet.SheetType = DrawingSheetTypeEnum.kSheetTypeDrawing Then oSheet.Name = partNumber & " " & stockNumber End If Next MsgBox("Sheet names have been modified.", MsgBoxStyle.Information) End Sub ' Call the subroutine to modify sheet names. Main()
Please check it and let me know how to do.
Thank you all.
Solved! Go to Solution.