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: 4
Default CommandBarComboBox : AddItem - procedure to attach routine.

Question :
=======
Exact syntax required when clicking/selecting AddItem 1 , I can invoke the
following Sub ShowExpenses()
Worksheets("Data").Select
End Sub


, on selecting AddItem 2, I can invoke the

Sub ShowSales()
Worksheets("Facility").Select
End Sub

and on selecting AddItem 3, I can invoke the following

Sub ShowPurchases()
Worksheets("Segment").Select
End Sub


Bye the way , I am little bit novice for VBA-EXCELL.





My entire procedure start from here :
========================



Sub CreateNewToolBar()
'the next two lines are only required during development
On Error Resume Next
CommandBars("Accounts").Delete

Dim NewMenuBar As CommandBar
Dim NewButton As CommandBarButton

Set NewMenuBar = CommandBars.Add("Accounts")

Set NewButton = NewMenuBar.Controls.Add(msoControlButton,
CommandBars("View").Controls("Normal").ID)
NewButton.Caption = "&Normal"
NewButton.Style = msoButtonIconAndCaptionBelow

Set NewButton = NewMenuBar.Controls.Add(msoControlButton,
CommandBars("View").Controls("Page Break Preview").ID)
NewButton.Caption = "&Preview"
NewButton.Style = msoButtonIconAndCaption

Set NewButton = NewMenuBar.Controls.Add(msoControlButton)
NewButton.Caption = "&Data"
NewButton.Style = msoButtonCaption
NewButton.OnAction = "ShowExpenses"

Dim NewComboboxButton As CommandBarComboBox
Set NewComboboxButton = NewMenuBar.Controls.Add(msoControlComboBox)
NewComboboxButton.Caption = "&Segment"
NewComboboxButton.OnAction = "ShowPurchases"
With CommandBars("Accounts").Controls(4)
.AddItem "Item 1", 1
.AddItem "Item 2", 2
.AddItem "Item 3", 3
.DropDownLines = 3
.ListIndex = 1
End With



Set NewButton = NewMenuBar.Controls.Add(msoControlButton)
NewButton.Caption = "&Facility"
NewButton.Style = msoButtonCaption
NewButton.OnAction = "ShowSales"

Set NewButton = NewMenuBar.Controls.Add(msoControlButton)
NewButton.Caption = "&E&xit"
NewButton.OnAction = "RestoreExcelMenuBar"
NewButton.Style = msoButtonCaption

Worksheets("AccountsSheet").Select
NewMenuBar.Visible = True
End Sub

Sub ShowExpenses()
Worksheets("Data").Select
End Sub

Sub ShowPurchases()
Worksheets("Segment").Select
End Sub

Sub ShowSales()
Worksheets("Facility").Select
End Sub

Sub RestoreExcelMenuBar()
CommandBars("Accounts").Delete
Application.Quit
End Sub


 
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
How to jump from a Form procedure to a Workbook or Module procedure? T. Erkson Excel Programming 4 January 25th 07 07:15 PM
commandbarCombobox problem MVM Excel Programming 7 January 27th 06 05:12 PM
.additem Robert Couchman[_4_] Excel Programming 3 February 20th 04 02:47 PM
CommandBarComboBox.AddItem - String Length Limit? Yishi Excel Programming 0 January 20th 04 07:21 PM


All times are GMT +1. The time now is 03:24 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"