Sub 图纸根据配置特性名称命名()
Dim SheetName() As String
Dim ConfigName As String
Set swApp = Application.SldWorks
Set drawing = swApp.ActiveDoc
SheetName = drawing.GetSheetNames
SheetCount = drawing.GetSheetCount
f = InputBox("请填写配置特性的名称")
If drawing Is Nothing Then
MsgBox "Drawing is empty!"
Exit Sub
End If
For i = 0 To SheetCount - 1
drawing.ActivateSheet SheetName(i)
Set swView = drawing.GetFirstView.GetNextView
Set swDrawModel = swView.ReferencedDocument
ConfigName = swView.ReferencedConfiguration
Set swSheet = drawing.GetCurrentSheet
ThisSheetName = swDrawModel.CustomInfo2(ConfigName, f) '图号可以根据配置特性改
swSheet.SetName ThisSheetName
Next