Hello all. Can anyone help me with a macro? I am trying to have a macro select a particular edge in every view on a drawing based on the edge that I select before running that macro but I cannot get it to work. This is what I have so far.
Sub main()
Dim swApp As Object
Dim Part As ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim swselmgr As SelectionMgr
Dim bret As Boolean
Set swApp = _
Application.SldWorks
Dim swdraw As DrawingDoc
Set Part = swApp.ActiveDoc
Set swdraw = Part
Set swselmgr = Part.SelectionManager
Dim myedge As Edge
Set myedge = swselmgr.GetSelectedObject(2)
Dim myview As View
Dim myviews As Variant
myviews = swdraw.GetViews
Dim count As Integer
count = 1
Part.ClearSelection2 (True)
For a = 1 To swdraw.GetViewCount
Set myview = myviews(0)(a)
Part.ActivateView (myview.Name)
bret = myview.SelectEntity(myedge, True)
Debug.Print bret
swdraw.EditRebuild
Next a
End Sub
SolidworksApi macros