Hi,
This should be simple but i am having no luck. The code below is in ThisWorkbook because I want the code to run on the Active Sheet. The Toolbar "ibar" and the dropdown list "View" appear when I open the workbook. but I can't figure out how to run a different Subroutine depending on which item is chosen from the dropdown.
I know this is basic stuff, but i can't figure it out.
This should be simple but i am having no luck. The code below is in ThisWorkbook because I want the code to run on the Active Sheet. The Toolbar "ibar" and the dropdown list "View" appear when I open the workbook. but I can't figure out how to run a different Subroutine depending on which item is chosen from the dropdown.
I know this is basic stuff, but i can't figure it out.
Code:
Sub Workbook_Open()
Dim ibar As CommandBar
Dim View As CommandBarControl
Set ibar = Application.CommandBars.Add(Name:="Implementation", Position:=msoBarTop)
ibar.Visible = True
Set View = ibar.Controls.Add(Type:=msoControlDropdown)
With View
.Visible = True
.Style = msoComboLabel
.Tag = "viewlist"
.Caption = "Choose View:"
.AddItem "Worksheet - Expanded", 1
.AddItem "Worksheet - Collapsed", 2
.AddItem "Worksheet - Summary", 3
.OnAction = "ThisworkBook.ChangeView"
End With
End Sub
Sub ChangeView()
?????
End Sub