Hello,
I'd like to change a global variable using a vb macro. How do I accomplish this?
Here's my attempt that does nothing:
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swEqnMgr As SldWorks.EquationMgr
Sub main(dim_name As String, dim_val As Long)
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swEqnMgr = swModel.GetEquationMgr
Dim eqn As String
Dim val As Double
i = swEqnMgr.GetCount
While i > 0
eqn = swEqnMgr.Equation(i)
a = InStr(eqn, "@")
If (a = 0) And eqn = dim_name Then
swEqnMgr.Value(i) = dim_val
End If
i = i - 1
Wend
swModel.ForceRebuild3 False
End Sub