Can't run this statement
Set DrwFormat = Part.FeatureByName(Sheet.GetSheetFormatName)
***************
the code is
****************
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim Feat As Feature
Dim DrwFormat As Feature
Dim Sheet As SldWorks.Sheet
Dim L As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SM = Part.SelectionManager
Set Feat = Part.FirstFeature
Do
Debug.Print Feat.Name
If Feat.GetTypeName = "DrSheet" Then
Set Sheet = Feat.GetSpecificFeature2 ' I left the a out of Feat
Set DrwFormat = Part.FeatureByName(Sheet.GetSheetFormatName)
End If
Set Feat = Feat.GetNextFeature
Loop While Not Feat Is Nothing
End Sub 'End sub needed space
*****************
Dim swApp As SldWorks.SldWorks
Dim SwDraw As SldWorks.DrawingDoc
Sub main()
Set swApp = Application.SldWorks
Set SwDraw = swApp.ActiveDoc
Debug.Print SwDraw.GetPathName
Dim SwSheet As SldWorks.Sheet
Set SwSheet = SwDraw.GetCurrentSheet
With SwSheet
oName = .GetSheetFormatName
.SetSheetFormatName "Sheet Format"
Debug.Print
End With
End Sub
SolidworksApi macros