Hi @Curtis_Waguespack ,
I am scouring the forum for code that will help automate our drawings process a little and it seems like you are involved in a lot of solutions. I hoping you can find the time to help me one more time.
Our Assembly .idw's will have at least 4 sheets named, e.g:
Page:1
Page:2
Partslist:1
Partslist:2
Page sheets are for illustrating the assemblies with their options or functions, the Partslist sheets hold the partslist, there will be more than one sheet if the partslist does not fit the A4 layout.
For the Partslist sheets I have a title block, different from the Page sheets, that I would like to have "Sheet # of #" automatically populate the set up fields, starting at "Sheet 1 of #" from sheet Partslist:1.
What I had in mind is for the code to check the sheet names and count the number of sheets called "Page" and use that amount for the below:
PartslistSheetsTotal = the actual Numbers of Sheets minus the Page sheets and
PartslistSheetNumber = the actual Sheet number minus Page sheets.
PartslistSheetsTotal would be a static value once all sheets are in the drawing file, but the variable for PartslistSheetNumber looks to be tricky.
I am trying to modify code from this post of yours https://forums.autodesk.com/t5/inventor-forum/changing-the-starting-sheet-number-in-an-idw-file/m-p/... along with what you posted above, but I am not getting the correct quantity of Page sheets. See my code below, it creates the custom iProperty, but the value is 0.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oSheets As Sheets
oSheets = ThisDoc.Document.Sheets
Dim oSheet As Sheet
oSheet = ThisDoc.Document.ActiveSheet
Dim oPageTotal As Integer
i = oPageTotal
'Iterate through the sheets
For Each oSheet In oSheets
oSheet.Activate
'Verify that the Sheet Name is Page
If oSheet.Name = "Page" Then
i = i+1
End If
Next
iProperties.Value("Custom", "PartslistSheetTotal") = oPageTotal
I would appreciate any assistance to get past the first step and further. I am very uncertain on how to create the variable for PartslistSheetNumber.