![]() |
Toggle calculation
I have assigned the following macro to a button on my Excel 2002
toolbar: Sub ToggleCalcMode() Dim nState As Long Dim sMode As String With Application If .Calculation = xlAutomatic Then .Calculation = xlManual nState = msoButtonDown sMode = "Manual" Caption = "Manual" Else .Calculation = xlAutomatic nState = msoButtonUp sMode = "Automatic" Caption = "Auto" End If End With End Sub I selected an icon from 'Change button image'. How can I change the picture of the toolbar button depending on whether I have it set to Automatic or Manual? |
Toggle calculation
Hi
Dave Peterson give you this answer (12 July) I've never had good luck keeping these in sync--if I change the calculation via tools|options, then my toolbar doesn't get updated. But this may work for you: Option Explicit Sub ToggleCalcMode() Dim nState As Long Dim sMode As String Dim myCaption As String Dim myFaceID As Long With Application If .Calculation = xlAutomatic Then .Calculation = xlManual nState = msoButtonDown sMode = "Manual" myCaption = "Manual" myFaceID = 100 Else .Calculation = xlAutomatic nState = msoButtonUp sMode = "Automatic" myCaption = "Auto" myFaceID = 101 End If With .CommandBars.ActionControl .Style = msoButtonIconAndCaption 'should have been set already .Caption = myCaption .State = nState .FaceId = myFaceID End With End With End Sub And Jim Rech has shared a nice program that will show faceid's: http://www.BMSLtd.ie/MVP/Default.htm Look for Jim Rech's: BtnFaces.zip -- Regards Ron de Bruin http://www.rondebruin.nl "FJDx" wrote in message ... I have assigned the following macro to a button on my Excel 2002 toolbar: Sub ToggleCalcMode() Dim nState As Long Dim sMode As String With Application If .Calculation = xlAutomatic Then .Calculation = xlManual nState = msoButtonDown sMode = "Manual" Caption = "Manual" Else .Calculation = xlAutomatic nState = msoButtonUp sMode = "Automatic" Caption = "Auto" End If End With End Sub I selected an icon from 'Change button image'. How can I change the picture of the toolbar button depending on whether I have it set to Automatic or Manual? |
Toggle calculation
"Ron de Bruin" wrote in message
... Hi Dave Peterson give you this answer (12 July) I've never had good luck keeping these in sync--if I change the calculation via tools|options, then my toolbar doesn't get updated. Thanks for your help. I didn't get Dave Peterson's reply. Must have been a problem with the newserver as I was watching the thread. |
All times are GMT +1. The time now is 12:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com