Im trying to loop through 4 pre-selected drawing views adding a "vertical alignment by center" to each view The 4th view as the baseview.
the following code works for the first one but dies on the second one.
WHAT IT SHOULD DO:
1.) select 4ea drawing views (they should be stacked vertically one on top of the next)
2.) the last view selected is the base view
all four views are aligned vertically by center
WHAT IT IS ACTUALLY DOING:
1.)the first view is aligned correctly
2.) error message stating an object variable is not set because swview is empty
I have no idea what im missing but its wearing on me!!
here is my code
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swView As SldWorks.View
Dim BoolStatus As Boolean
Dim BaseView As SldWorks.View
Dim i As Integer
Dim ViewCount As Double
'Connect to Solidworks & active document
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
'get selected drawingview count
ViewCount = swSelMgr.GetSelectedObjectCount2(-1)
'define Baseview as the 4th view selected
Set BaseView = swSelMgr.GetSelectedObject6(4, -1)
For i = 1 To ViewCount
Set swView = swSelMgr.GetSelectedObject6(i, -1)
BoolStatus = swView.AlignWithView(swAlignViewTypes_e.swAlignViewVerticalCenter, BaseView)
i = i + 1
Thanks again !