Bri Guy

Please take a look at this Macro

Discussion created by Bri Guy on Mar 16, 2020
Latest reply on Mar 16, 2020 by Bri Guy

' SW drawing is open
'post condtions
' drawing sheet names added to drawing document properties list
' rebuild

Sub main()
Dim swApp As Object
Dim swSheet As SldWorks.Sheet
Dim swDraw As SldWorks.DrawingDoc
Dim vSheetNames As Variant
Dim i As Long
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim boolstatus As Boolean

Set swApp = Application.SldWorks
Set swDraw = swApp.ActiveDoc
Set swSheet = swDraw.GetCurrentSheet
Set swCustPropMgr = swDraw.Extension.CustomPropertyManager("")

vSheetNames = swDraw.GetSheetNames

'delete exising properties 0 through 10
For i = 0 To 17
swCustPropMgr.Delete i
Next i
'repopulate properties 0 through -- with sheet names
For i = 0 To UBound(vSheetNames)
swDraw.ActivateSheet (vSheetNames(i))
Set swSheet = swDraw.GetCurrentSheet
retval = swDraw.AddCustomInfo2(i, swCustomInfoText, vSheetNames(i))
Next i
For i = UBound(vSheetNames) - 1 To 16
retval = swDraw.AddCustomInfo2(i, swCustomInfoText, "")
Next i
swDraw.ActivateSheet (vSheetNames(0))
swDraw.ForceRebuild3 (True)
MsgBox ("Complete")
End Sub




This code is intended to take the name of the assembly or part and put it in the sheet name. Does anyone know why this stopped working?