I run dual screens when I work and I'm not exactly satisfied with the way SW deals with files when you open them on a dual screen system, i.e. my parts open centered on the split. Typically, I "restore down", resize the window to fit nicely on one screen and drag it there. Easy enough, but this gets old 30x a day. So I made a key stroke macro, edited out the 100 lines of extra code and came up with this:
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.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
Set Part = swApp.ActiveDoc
Set myModelView = Part.ActiveView
myModelView.FrameLeft = 0
myModelView.FrameTop = 21
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowNormal
Set Part = swApp.ActiveDoc
Set myModelView = Part.ActiveView
myModelView.FrameLeft = -5
myModelView.FrameTop = 25
Set Part = swApp.ActiveDoc
myModelView.FrameWidth = 1907
myModelView.FrameHeight = 838
Part.ViewZoomtofit2
End Sub
The macro works like a charm if I run it from tools or drag it to my toolbar, so I tried assigning ctrl+z to it through the customizing procedure...create folder in sw data named macros etc. The command shows up fine in customize keyboard, but will not run when any keystroke is assigned to it.
Any insights?
SolidworksApi macros