Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone
I need to change color of my buttons after they are clicked. I have already a macro triggered by the buttons which hides and shows charts. So I want to add some codes to those macros in order to change colors of buttons.
I have found some related topcis in forum but I could not open any of them. So I would be preciated if someone can send me VB codes.
Thank You
HealMe_Solutions
There are many way to do this. Here is an example:
1. Create a variable for color, for example vColor, and use it in your button color (calculated color):
=$(vColor)
2. Macro that switches color:
sub Macro
set c = ActiveDocument.Variables("vColor")
if c.GetContent.string="rgb(255,200,200)" then
c.SetContent "rgb(200,255,200)", true
else
c.SetContent "rgb(255,200,200)", true
end if
end sub
There are many way to do this. Here is an example:
1. Create a variable for color, for example vColor, and use it in your button color (calculated color):
=$(vColor)
2. Macro that switches color:
sub Macro
set c = ActiveDocument.Variables("vColor")
if c.GetContent.string="rgb(255,200,200)" then
c.SetContent "rgb(200,255,200)", true
else
c.SetContent "rgb(255,200,200)", true
end if
end sub
Thank you for your reply Michael.
A last Question. Where Should I create vColor variable, in Load script, in macro VB part or some where in the Button?
Thank You
Not in macro Variables can be created in the script on from front end. In this case, the appropriate way is to use toolbar Setting -> Variable Overview, click Add, type variable name (in this case vColor), and OK.
Thank you all. It helped so much...
Hi All, I have a similar question and I having some trouble inputting this in my macro. Anyway someone can explain this simplier?