ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
BCByron Chiu15/01/2020

Hello Community,

I am tweaking a recorded macro that opens an assembly file and adds a component into it (for this post, the macro's capabilities are simplified/censored), setting it at the assembly's origin. The macro gets stuck at "boolstatus = swInsertedComponent.SetTransformAndSolve2(swTransform)", after the transform matrix for the inserted component is set & solved ("Set swTransform = swMathUtil.CreateTransform((TransformDataVariant))").

This error states that "Object variable or With block variable was not set". I read that a macro-recorder does not capture all code, and that some script may be hard-coded and in need of rewriting to make the macro work. However, I cannot find instances of either in the script. I am also using this guide to hopefully find a fix: Object variable or With block variable not set - Visual Basic | Microsoft Docs 

The code is essentially untouched since it was recorded. What specific variable is Solidworks telling me to set, here?