3 Replies Latest reply: Feb 22, 2011 10:21 PM by Nick Gan RSS

    Color Button


      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 [;)]

        • Color Button
          Miguel Angel Baeyens de Arce

          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!