W
wal
Excel 2003
I created a button using Right-click-on-control-bars > Customize, and
assigned the following macro to it:
Sub ToggleCalculation()
Dim myBar As CommandBar, myControl As CommandBarButton
Set myBar = CommandBars("myMacros")
Set myControl = myBar.Controls("ToggleCalculation")
If Application.Calculation = xlCalculationAutomatic Then
Application.Calculation = xlCalculationManual
myControl.State = msoButtonUp
ElseIf Application.Calculation = xlCalculationManual Then
Application.Calculation = xlCalculationAutomatic
myControl.State = msoButtonDown
End If
MsgBox myControl.State
End Sub
When I press the button, the calculation setting does toggle. But the
button stays in the "up" position (.State = 0).
Any ideas? Thanks.
I created a button using Right-click-on-control-bars > Customize, and
assigned the following macro to it:
Sub ToggleCalculation()
Dim myBar As CommandBar, myControl As CommandBarButton
Set myBar = CommandBars("myMacros")
Set myControl = myBar.Controls("ToggleCalculation")
If Application.Calculation = xlCalculationAutomatic Then
Application.Calculation = xlCalculationManual
myControl.State = msoButtonUp
ElseIf Application.Calculation = xlCalculationManual Then
Application.Calculation = xlCalculationAutomatic
myControl.State = msoButtonDown
End If
MsgBox myControl.State
End Sub
When I press the button, the calculation setting does toggle. But the
button stays in the "up" position (.State = 0).
Any ideas? Thanks.