AnsweredAssumed Answered

Exit macro with escape?

Question asked by John Boire on Dec 20, 2017
Latest reply on Dec 22, 2017 by Ulf Stockburger

Background:
I am attempting to write a macro that will allow users to select lines on their drawings and then the lines will become bolded.
That part of the code is working great, however it just wont stop.  The macro keeps running and I cannot end it. I have included the text for users to check.

 

I do not know exactly what is happening here as this is my first time dealing with classes

 

Code text:

 

Dim swApp As SldWorks.SldWorks

 

Dim swModel As SldWorks.ModelDoc2

Dim swDraw As SldWorks.drawingDoc

Dim selMgr As SldWorks.SelectionMgr

 

Dim boolstatus As Boolean

Dim drawingDoc As New Class1

 

Sub main()

 

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

 

drawingDoc.init swModel

 

End Sub

 

Class1:

Public WithEvents doc As drawingDoc

 

Public Function init(ByRef docin As Object)

    Set doc = docin

End Function

 

Private Function doc_UserSelectionPostNotify() As Long

        doc.SetLineWidth 3

End Function

Outcomes