I am trying to make a maco to load a drawing template.
I recorded a maco by doing creating a new document and it generated this code.
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.NewDocument("A PORTRAIT SHEET 2.SLDDRT", 1, 0.2794, 0.2159)
swApp.ActivateDoc2 "Draw1 - Sheet1", False, longstatus
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
End Sub
When I run this macro it brings up the sheet format box for me to pick the template that I want.
I tried changing the "A PORTRAIT SHEET 2.SLDDRT" to the actual template name but that causes the macro to crash.
Any help would be greatly appreciated.
Thanks
Ken
SolidworksApi macros