Toolbars and menus

D

DMc2005

Hi

i am having a real knightmare with this. The first sub routine
CreateAddin_Toolbar works with no problems. The second sub routine Menu
works okay. This was an example i got from a help file. What i want to do is
to convert it into the same format as the routine CreateAddin_Toolbar. I am
having problems with this as at the top of my module i have declared the
Option Explicit.

Any ideas?

Next I have put a combo box onto the toolbar how do i reference what
somebody has selected on that toolbar, ie item 1 or 2.

D

Sub CreateAddin_Toolbar()

Dim lcbGrad As CommandBar

Set lcbGrad = CommandBars.Add(strMenuBarName, msoBarFloating, , True)
With lcbGrad
With .Controls
'the code below adds a button
With .Add(msoControlButton)
.Style = msoButtonIcon
.FaceId = 463
.Caption = "About"
.OnAction = "About"
End With
With .Add(msoControlComboBox)
.AddItem "Test", 1
.AddItem "Two", 2
.DropDownLines = 3
.DropDownWidth = 75
.ListHeaderCount = 0
End With
With .Add(msoControlDropdown)
.AddItem "Test", 1
.AddItem "Two", 2
.DropDownLines = 3
.DropDownWidth = 75
.ListHeaderCount = 0
End With
With .Add(msoControlPopup)
.Caption = "About"
.OnAction = "About"
End With

End With
'ensures the bar is visible.
.Visible = True

End With
End Sub

'fdsssssssssssssssssssssssss
Sub Menu()
Set mymenubar = CommandBars.ActiveMenuBar
Set newMenu = mymenubar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "Custom"
Set ctrl1 = newMenu.Controls _
.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Import"
ctrl1.TooltipText = "Import"
ctrl1.Style = msoButtonCaption
End Sub




End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top