Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I wonder if someone can help.
I set up a variable in script: LET vZoom=0;
I'm trying to create a button that will toggle the value of the variable between 0 and 1 every time I press it by running the following macro:
SUB Zoom_Toggle()
Select Case vZoom
Case 1
vTest=0
Case 0
vTest=1
End Select
ActiveDocument.Variables("vZoom").SetContent vTest, true
END SUB
However, the button only seems to change the value the first time I press it and stops working.
Am I missing something?
Thanks for helping
Excellent. .Number didn't work but I found that .String did and now the button works perfectly.
Cheers!
You're not referencing the variable correctly in your Case.
SUB Zoom_Toggle()
Select Case ActiveDocument.Variables("vZoom").GetContent.Number
Case 1
vTest=0
Case 0
vTest=1
End Select
ActiveDocument.Variables("vZoom").SetContent vTest, true
END SUB
I think it is .Number there.
Excellent. .Number didn't work but I found that .String did and now the button works perfectly.
Cheers!