Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Command bar woe

Hi all,

Can anyone tell me the problem here? I'm adding a toolbar that does various
things that are useful to me. It works fine right up to the
msoContolButtonDropDown, upon trying to add which I get error 5, invalid
procedure call/argument. Does the dropdown button not work properly? Or,
more likely, am I missing something?

Cheers,

Jeff

With CommandBars.Add(Name:="Jaffa's Toolbar")
With .Controls.Add(Type:=msoControlButton)
.OnAction = "GenFooter"
.FaceId = 29
.TooltipText = "Add Footer"
End With
With .Controls.Add(Type:=msoControlButton)
.OnAction = "Nofooter"
.FaceId = 3265
.TooltipText = "Remove Footer"
End With
With .Controls.Add(Type:=msoControlButton)
.OnAction = "Footeropt"
.FaceId = 5598
.TooltipText = "Footer Options"
End With
With .Controls.Add(msoControlComboBox)
.OnAction = "SheetSel"
.Tag = "cmdSheetSel"
End With
With .Controls.Add(msoControlButton)
.OnAction = "RowSel"
.FaceId = 7008
.TooltipText = "Select whole rows"
End With
With .Controls.Add(msoControlButton)
.OnAction = "ColSel"
.FaceId = 7009
.TooltipText = "Select whole columns"
End With
With .Controls.Add(msoControlButton)
.OnAction = "RangCalc"
.TooltipText = "Recalculate selection"
.FaceId = 1952
End With
With .Controls.Add(msoControlButton)
.OnAction = "CopyFolderLink"
.TooltipText = "Copy folder tree"
.FaceId = 1667
End With
With .Controls.Add(msoControlButtonDropdown)
.Tag = "cmdCalcChange"
Select Case Application.Calculation
Case xlCalculationAutomatic
.FaceId = 6735
Case xlCalculationManual
.FaceId = 6743
Case xlCalculationSemiautomatic
.FaceId = 6751
End Select
With .AddItem
.OnAction = "CalcChangeM"
.TooltipText = "Manual calculation"
.FaceId = 6743
End With
With .AddItem
.OnAction = "CalcChangeS"
.TooltipText = "Semiautomatic calculation"
.FaceId = 6751
End With
With .AddItem
.OnAction = "CalcChangeA"
.TooltipText = "Automatic calculation"
.FaceId = 6735
End With
End With
End With


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Command bar woe

Jeff,

While that is a valid type of commandbutton, not all types are available to
the user for cutom commandbars. IIRC, only five of the many types are
available to the end user. The other types are for built-in controls, so
the constants are there because those types return those values when reading
the properties of the built in controls.

HTH,
Bernie
MS Excel MVP

"Jeff Standen" wrote in message
...
Hi all,

Can anyone tell me the problem here? I'm adding a toolbar that does

various
things that are useful to me. It works fine right up to the
msoContolButtonDropDown, upon trying to add which I get error 5, invalid
procedure call/argument. Does the dropdown button not work properly? Or,
more likely, am I missing something?

Cheers,

Jeff

With CommandBars.Add(Name:="Jaffa's Toolbar")
With .Controls.Add(Type:=msoControlButton)
.OnAction = "GenFooter"
.FaceId = 29
.TooltipText = "Add Footer"
End With
With .Controls.Add(Type:=msoControlButton)
.OnAction = "Nofooter"
.FaceId = 3265
.TooltipText = "Remove Footer"
End With
With .Controls.Add(Type:=msoControlButton)
.OnAction = "Footeropt"
.FaceId = 5598
.TooltipText = "Footer Options"
End With
With .Controls.Add(msoControlComboBox)
.OnAction = "SheetSel"
.Tag = "cmdSheetSel"
End With
With .Controls.Add(msoControlButton)
.OnAction = "RowSel"
.FaceId = 7008
.TooltipText = "Select whole rows"
End With
With .Controls.Add(msoControlButton)
.OnAction = "ColSel"
.FaceId = 7009
.TooltipText = "Select whole columns"
End With
With .Controls.Add(msoControlButton)
.OnAction = "RangCalc"
.TooltipText = "Recalculate selection"
.FaceId = 1952
End With
With .Controls.Add(msoControlButton)
.OnAction = "CopyFolderLink"
.TooltipText = "Copy folder tree"
.FaceId = 1667
End With
With .Controls.Add(msoControlButtonDropdown)
.Tag = "cmdCalcChange"
Select Case Application.Calculation
Case xlCalculationAutomatic
.FaceId = 6735
Case xlCalculationManual
.FaceId = 6743
Case xlCalculationSemiautomatic
.FaceId = 6751
End Select
With .AddItem
.OnAction = "CalcChangeM"
.TooltipText = "Manual calculation"
.FaceId = 6743
End With
With .AddItem
.OnAction = "CalcChangeS"
.TooltipText = "Semiautomatic calculation"
.FaceId = 6751
End With
With .AddItem
.OnAction = "CalcChangeA"
.TooltipText = "Automatic calculation"
.FaceId = 6735
End With
End With
End With




Reply
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
One command in one cell initiating another command in another cel. Chas52 Excel Worksheet Functions 3 November 7th 09 06:57 PM
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


All times are GMT +1. The time now is 03:26 AM.

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

About Us

"It's about Microsoft Excel"