AnsweredAssumed Answered

How to fix 'swApp not declared'

Question asked by John Karsten on May 9, 2019
Latest reply on May 10, 2019 by John Karsten

Hey guys. I'm building an add-in(used the SW template) and trying to get some simple code to run via a command button. I copied this code from the macro recorder and made some edits, such as removing the 'set' function and adding parenthesis around arguments. I can't figure out how to get rid of the "swApp not declared", "Application not declared" and "SWVerify not declared". I've played around with some statements I've found by searching, but when I run the code, SW just power exits. I think if I can learn how to fix this problem, I can trouble shoot my other VBA macros. I have some nice utilities built using the SW VBA editor. Currently looking for a good book on SW and .NET


Dim Part As Object
Dim boolstatus As Boolean

swApp = Application.SldWorks

Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Dim skSegment As Object
skSegment = Part.SketchManager.CreateCircle(0#, 0#, 0#, 0.019991, 0.015967, 0#)swApp error