Code:
Option Explicit OnDim DrawDoc As DrawingDocument= ThisDoc.Document
Dim DetailString As String
DetailString = "A"
Dim DetailLetter As String
DetailLetter = "A"
Dim SectionLetter As String
SectionLetter = "Z"
Dim SectionString As String
SectionString = "Z"
Dim iDL As Integer
Dim iSL As Integer
Dim i As Integer
Dim oSheet As Sheet
Dim oView As DrawingView
Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(DrawDoc, "RenameViews")
For Each oSheet In DrawDoc.Sheets
For Each oView In oSheet.DrawingViews
If oView.Suppressed=False Then
If oView.ViewType = 10502 Then 'kDetailDrawingViewType
oView.Name = DetailString
iDL = Asc(DetailLetter)
If iDL = 90 Then
Dim DetailStringLength As Integer
DetailStringLength = Len(DetailString) + 1
DetailString = ""
DetailLetter = "A"
For i = 1 To DetailStringLength
DetailString = DetailString & DetailLetter
Next
Else
DetailLetter = Chr(Asc(Right(DetailString, 1)) + 1)
DetailString = Left(DetailString, Len(DetailString) - 1) & DetailLetter
End If
End If
If oView.ViewType = 10503 Then 'kSectionDrawingViewType
oView.Name = SectionString
iSL = Asc(SectionLetter)
If iSL = 65 Then
Dim SectionStringLength As Integer
SectionStringLength = Len(SectionString) + 1
SectionString = ""
SectionLetter = "Z"
For i = 1 To SectionStringLength
SectionString = SectionString & SectionLetter
Next
Else
SectionLetter = Chr(Asc(Right(SectionString, 1)) - 1)
SectionString = Left(SectionString, Len(SectionString) - 1) & SectionLetter
End If
End If
End If
Next
Next
oTrans.End