View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Toolbar Menu problems

I have set the following code up to create a new toolbar, it works until I
try to add the rsOp1 and rsOp2 popup items - what is wrong with this code?

Dim rsTB As CommandBar
Set rsTB = Application.CommandBars.Add(Name:="rsTB", Position:=msoBarTop,
MenuBar:=False)
rsTB.Visible = True
rsTB.Protection = msoBarNoChangeVisible + msoBarNoResize +
msoBarNoChangeDock

Dim rsBut As CommandBarPopup
Dim rsOp1 As CommandBarPopup, rsOp2 As CommandBarPopup

Set rsBut =
Application.CommandBars("rsTB").Controls.Add(Type: =msoControlPopup,
befo=1)
Set rsOp1 = Application.CommandBars("rsTB").Controls("rsBut"). Controls.Add()
Set rsOp2 = Application.CommandBars("rsTB").Controls("rsBut"). Controls.Add()

rsBut.Caption = "SAM Report"
rsOp1.Caption = "Summary"
rsOp2.Caption = "Targets"

--
Cheers
Nigel