LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Calculation mode

I have created a custom "Calculation" toolbar that gives
me the functions "Calc Sheet", "Calc Full", and "Calc
Now." I also added a button that uses VBA code to toggle
between Manual, Automatic, and Semiautomatic calc modes.
The code also changes the caption on the button to
read "MANUAL", "AUTO" or "SEMI" depending on the currently
selected mode. So far so good...

The problem: When I start up Excel, the caption on my
button does not necessarily reflect the current
calculation mode. It always comes up as "AUTO." As soon
as I press the button it reads the mode and the caption
changes appropriately, but I sure would like to know by
that button what mode I am in when I start up, without
having to press the dang thing.

I have tried various routines to run on workbook open,
activate, etc... I try reading the current calculation
mode and setting the button caption accordingly. The
routines work fine when I test them with Excel already up
and running, so I am fairly confident the code works, but
it still displays improperly when I first start Excel.

Perhaps it is timing - that I am trying to read the calc
mode when it is still in its default setting, before
applying any saved settings? I still can't figure it
out. Anyone out there who can help?

Here's the code to toggle the mode and set the caption - I
have it in my Personal.xls workbook:

Sub CalcMode()

Dim CurrentMode As Integer

CurrentMode = Application.Calculation

Select Case CurrentMode
Case xlCalculationAutomatic
Application.Calculation = xlCalculationManual
Case xlCalculationManual
Application.Calculation = xlCalculationSemiautomatic
Case xlCalculationSemiautomatic
Application.Calculation = xlCalculationAutomatic
Case Else
Application.Calculation = xlCalculationAutomatic
End Select

CurrentMode = Application.Calculation

Select Case CurrentMode
Case xlCalculationAutomatic
Application.CommandBars("Calculation").Controls
(1).Caption = "AUTO"
Case xlCalculationManual
Application.CommandBars("Calculation").Controls
(1).Caption = "MANUAL"
Case xlCalculationSemiautomatic
Application.CommandBars("Calculation").Controls
(1).Caption = "SEMI"
Case Else
Application.CommandBars("Calculation").Controls
(1).Caption = "???"
End Select

End Sub

Thanks in advance...
K Dales
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent Manual Calculation Mode Evan Weiner Excel Discussion (Misc queries) 1 April 14th 10 05:07 PM
Selective Calculation of Mean & Mode stevekanc Excel Worksheet Functions 3 September 22nd 07 07:27 PM
manual calculation mode Victor Excel Discussion (Misc queries) 0 June 18th 07 10:44 PM
Ommitting 0 from a mode calculation. Steve Excel Discussion (Misc queries) 1 October 4th 06 08:58 AM
My Calculation Mode Changed to Manual Somehow?!? Jeb Excel Discussion (Misc queries) 2 August 4th 05 03:40 PM


All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"