title: Disable Ribbon button in Excel
body: <p>I'm trying to make it so that a custom button is disabled depending on the toggle state of another custom button on the Excel ribbon. I have a button defined in my ribbons' XML as follows:</p>
  
  <pre><code>&lt;button id="ButtonCalc" label="Re-Calculate" size="large" onAction="calc" image="Calculate" getEnabled="disableRefresh"/&gt;
  </code></pre>
  
  <p>The call-back for the getEnabled tag is:</p>
  
  <pre><code>'Callback for ButtonCalc getEnabled
  Sub disableRefresh(control As IRibbonControl, ByRef enabled)
  
  If calcState Then
  
      enabled = True
  
  Else
      enabled = False
  
  End If
  End Sub
  </code></pre>
  
  <p>The term "calcstate" is a boolean operation controlled by the toggle button:</p>
  
  <pre><code>&lt;toggleButton id="ButtonMode" label="Light Mode" size="large" onAction="ToggleCalcClicked" image="Mode" getPressed="checkLight"/&gt;
  </code></pre>
  
  <p>VBA for this part:</p>
  
  <pre><code>Public calcState As Boolean
  
  Dim MyRibbon As IRibbonUI
  
  Sub ToggleCalcClicked(control As IRibbonControl, pressed As Boolean)
  
  calcState = Not calcState
  Worksheets("Setup").Range("L47").Value = calcState
  
  Call ChangeCalcState
  
  End Sub
  </code></pre>
  
  <p>Everything works, except the button for Re-calculate is permanently disabled. What have I done wrong?</p>