Hi, I think this code could serve you.
Maybe adapting it to your need
Dim oDoc As DrawingDocument= ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
'Calculate number of sheets
Dim oSheetNumbers As String = oDoc.Sheets.Count
Dim i As Integer, SheetNumber As Integer
For i = 1 To oSheetNumbers
If oDoc.Sheets(i).Name = oSheet.Name Then
SheetNumber = i
Exit For
End If
Next
MessageBox.Show( "Number of sheets: " & oDoc.Sheets.Count)
MessageBox.Show( "SheetNumber: " &SheetNumber)
If you want to add this property to a note, you should access in a similar way to this.
Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oView As DrawingView = oDoc.ActiveSheet.DrawingViews(1)
oView.Label.FormattedText = "<StyleOverride><DerivedProperty DerivedID='29704'>Sheet Number</DerivedProperty></StyleOverride><Br/><StyleOverride><DerivedProperty DerivedID='29703'>Number of sheets</DerivedProperty></StyleOverride>"
In this example, the label of the view of a drawing file will be changed with the two values you are looking for.
I hope this helps with your problem.
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn