View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default How activate "NUM" thingie?

Ok, I looked further into this and found a way to access the items on
the right-click popup. This commandbar's name is "AutoCalculate". Each
menuitem (control) can be accessed as follows...

CommandBars("AutoCalculate").Controls("&None").Exe cute
OR
CommandBars("AutoCalculate").Controls(1).Execute

...where you can specify the menuitem by its Caption or its Index as
listed below.

1 &None
2 &Average
3 &Count
4 C&ount Nums
5 &Max
6 M&in
7 &Sum

This looks like a perfect candidate for an enum if you want to make it
self-documenting in code...

Enum AutoCalc
None = 1
Average
Count
CountNums
Max
Min
Sum
End Enum

...so you can use it in code as follows...

CommandBars("AutoCalculate").Controls(AutoCalc.Ave rage).Execute

...so it works with AutoSense while typing in a code window.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion