Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey Guys, I need to change the color button in a macro but with a button macro property. For example:
set button1 = ActiveDocument.getsheetobject("BU75")
set buttonprop = button1.GetProperties
buttonpro.color = "#12345" or buttonpro.color = "rgb(255,0,0')" or etc...
but I need the method for the button object.
Thanks [;)]
Hello Marco,
Check this:
Sub ChangeBtnColor set vStatus = ActiveDocument.GetVariable("vButtonClicked") s = vStatus.GetContent.String set btn = ActiveDocument.GetSheetObject("BU01") set prop = btn.GetProperties if s = "1" then prop.BkgColor.PrimaryCol.Col = RGB(255,0,0) prop.TextColor.PrimaryCol.Col = RGB(255,255,255) btn.SetProperties prop vStatus.SetContent "0", true else prop.BkgColor.PrimaryCol.Col = RGB(0,0,255) prop.TextColor.PrimaryCol.Col = RGB(0,0,0) btn.SetProperties prop vStatus.SetContent "1", true end if End Sub
I use a variable to check if the button as been clicked. You can skip that part.
Hope it helps!
Hello Marco,
Check this:
Sub ChangeBtnColor set vStatus = ActiveDocument.GetVariable("vButtonClicked") s = vStatus.GetContent.String set btn = ActiveDocument.GetSheetObject("BU01") set prop = btn.GetProperties if s = "1" then prop.BkgColor.PrimaryCol.Col = RGB(255,0,0) prop.TextColor.PrimaryCol.Col = RGB(255,255,255) btn.SetProperties prop vStatus.SetContent "0", true else prop.BkgColor.PrimaryCol.Col = RGB(0,0,255) prop.TextColor.PrimaryCol.Col = RGB(0,0,0) btn.SetProperties prop vStatus.SetContent "1", true end if End Sub
I use a variable to check if the button as been clicked. You can skip that part.
Hope it helps!
Miguel, your help was very useful, it work perfect..!!! 😉 Thank you very much
Hi Miguel,
Is this for one button?
How can i make it to detect multiple buttons?
I'm trying to avoid repeating the script for different buttons action.
Thanks.