- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need help naming my sheets with the active sheets part number plus the sheet number. I have the part number portion working correctly but I cant get the sheet number portion to work. In the end I'm wanting my sheet name to look like "aaaaaab" (where as a=part number and b=sheet number).
Here is what I have so far:
SyntaxEditor Code Snippet
Dim oSheets As Sheets = ThisDrawing.Document.sheets Dim oSheet As Sheet Dim SheetNumber As Integer For Each oSheet In oSheets oSheet.activate oModel = IO.Path.GetFileName(ActiveSheet.View("ISO").ModelDocument.FullFileName) 'MessageBox.Show(oModel) oDoc = ThisDoc.Document SheetNumber = Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1) partnum = iProperties.Value(oModel, "Project", "Part Number")("SheetNumber") 'MessageBox.Show(partnum) ActiveSheet.Sheet.Name = partnum Next
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Please try using following code:
SyntaxEditor Code Snippet
Dim oSheets As Sheets = ThisDrawing.Document.sheets Dim oSheet As Sheet Dim SheetNumber As String For Each oSheet In oSheets oSheet.activate oModel = IO.Path.GetFileName(ActiveSheet.View("ISO").ModelDocument.FullFileName) 'MessageBox.Show(oModel) oDoc = ThisDoc.Document MessageBox.Show (Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1)) SheetNumber = Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1) partnum = iProperties.Value(oModel, "Project", "Part Number")(Int(sheetnumber)) MessageBox.Show (partnum ) 'MessageBox.Show(partnum) ActiveSheet.Sheet.Name = SheetNumber + partnum Next

Jane Fan
Inventor QA Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Sorry, I must have misunderstood your intention.
Please let me know whether this is what you need: Name of partnumber + Sheet.index.
SyntaxEditor Code Snippet
Dim oSheets As Sheets = ThisDrawing.Document.sheets Dim oSheet As Sheet Dim SheetNumber As String For Each oSheet In oSheets oSheet.activate oModel = IO.Path.GetFileName(ActiveSheet.View("ISO").ModelDocument.FullFileName) 'MessageBox.Show(oModel) oDoc = ThisDoc.Document MessageBox.Show (Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1)) SheetNumber = Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1) partnum = iProperties.Value(oModel, "Project", "Part Number") MessageBox.Show (partnum ) 'MessageBox.Show(partnum) ActiveSheet.Sheet.Name = partnum + "-" + SheetNumber Next

Jane Fan
Inventor QA Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
oModel = IO.Path.GetFileName(ActiveSheet.View("ISO").ModelDocument.FullFileName)
Can you write me what exacly should be write instead "ISO". I'm trying diferrents names, but I get: 'Sheet.View: Not found draw's name 'ISO'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It works, when you want to give same text from first sheet (Part number) for all sheets. Do you know how get text from Part number for each sheets separatly?