From b4205f321a08f1ff1ecb36ceb13b69db103df6b3 Mon Sep 17 00:00:00 2001 From: Andrea Mollo <119691950+andrMollo@users.noreply.github.com> Date: Thu, 28 Nov 2024 08:01:22 +0100 Subject: [PATCH] Use function parameters instead of constants The two functions now use their parameters instead of the global constants --- .../document/change-global-variable-value/Macro.vba | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solidworks-api/document/change-global-variable-value/Macro.vba b/solidworks-api/document/change-global-variable-value/Macro.vba index 7a017c3e..4fc9db25 100644 --- a/solidworks-api/document/change-global-variable-value/Macro.vba +++ b/solidworks-api/document/change-global-variable-value/Macro.vba @@ -34,7 +34,7 @@ Function SetEquationValue(eqMgr As SldWorks.EquationMgr, name As String, value A index = GetEquationIndexByName(eqMgr, name) If index <> -1 Then - eqMgr.Equation(index) = """" & name & """=" & NEW_VALUE + eqMgr.Equation(index) = """" & name & """=" & value SetEquationValue = True Else SetEquationValue = False @@ -54,7 +54,7 @@ Function GetEquationIndexByName(eqMgr As SldWorks.EquationMgr, name As String) A eqName = Trim(Split(eqMgr.Equation(i), "=")(0)) eqName = Mid(eqName, 2, Len(eqName) - 2) 'removing the "" symbols from the name - If UCase(eqName) = UCase(VAR_NAME) Then + If UCase(eqName) = UCase(name) Then GetEquationIndexByName = i Exit Function End If