AnsweredAssumed Answered

DoEvents in VB (SW2011)

Question asked by Pedro Saraiva on Nov 24, 2011
Latest reply on Nov 29, 2011 by Rafal Lancucki


I used to work with some Macros I made in the past for SW2009.

After the upgrade for the SW2011 some of those macros stop working.

I solved almost all the issues but there still one I don’t know how

In some point of the macro I used the function “DoEvents” to wait for a surface selection by the SW user, this selection used to return the value 1 on the objCount.

See example:






objCount = SelMgr.GetSelectedObjectCount


If VarLoop = 1 Then


objCount = 1

End If

If VarLoop = 2 Then


objCount = 1

End If

If VarLoop = 3 Then


VarLoop = 0

End If

Loop Until objCount = 1


In SW2011 this doesn’t work.

The macro don’t came out from the loop because it doesn’t allow me to select anything in the working area.

The most amazing thing is, if I start the macro directly from the VB window (using the edition of the macro and make the debug from there) the macro works perfectly....

Another issue I had is, any time I call for a new form that form stays behind the SW window. Is this a Solid Works bug or is a Windows 7 bad configuration?

Thanks in advanced