Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Listbox on custom toolbar?

Excel allows one to drag a listbox, combo box, etc. to a custom toolbar,
and will label it to match -- but I cannot find any references as to how
to populate. I'm thinking it needs to be done through code as I cannot
bring up the properties window to assigned a source range or linked cell
as one would do if placing on a form. Any thoughts??? Thanks!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Listbox on custom toolbar?

Larry Adams wrote:
Excel allows one to drag a listbox, combo box, etc. to a custom toolbar,
and will label it to match -- but I cannot find any references as to how
to populate.


I am not aware that you can put a listbox on a toolbar, but certainly you
can create a commbobox or dropdown by using code

Sub test()
With Application.CommandBars.Add("MyBar", temporary:=True)
.Visible = True
With .Controls.Add(msoControlDropdown)
.Caption = "MyBox"
.AddItem "A"
.AddItem "B"
.AddItem "C"
End With
End With
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Combobox on custom toolbar?

Bill, I very much appreciate the example, but now I need to understand the
coding conventions to (a) identify and (b) work with an existing combobox
control on an existing toolbar. Any suggestions? Thanks!

Bill Manville wrote:

Larry Adams wrote:
Excel allows one to drag a listbox, combo box, etc. to a custom toolbar,
and will label it to match -- but I cannot find any references as to how
to populate.


I am not aware that you can put a listbox on a toolbar, but certainly you
can create a commbobox or dropdown by using code

Sub test()
With Application.CommandBars.Add("MyBar", temporary:=True)
.Visible = True
With .Controls.Add(msoControlDropdown)
.Caption = "MyBox"
.AddItem "A"
.AddItem "B"
.AddItem "C"
End With
End With
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Combobox on custom toolbar?

Larry Adams wrote:
I need to understand the
coding conventions to (a) identify and (b) work with an existing combobox
control on an existing toolbar.



With Application.CommandBars("MyToolbar")
With .Controls("MyComboBox") ' the name is the caption that pops up
MsgBox .Value & " is selected" & vbCrLf & "It is entry " & .ListIndex+1
End With
End With

If that doesn't cover what you wanted, please give more details.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Combobox on custom toolbar?

Okay, this gave me enough clues and I have some test code running okay. By
"work with an existing combo box control", I was mostly looking for a good
summary of what properties and methods apply specifically to toolbars and
toolbar controls. The help system has this information, more or less, but I
have been hoping to find a comprehensive example showing what all one can do in
working with toolbar controls. But I have a working start -- which is much
better than before. Thanks much. Larry.

Bill Manville wrote:

Larry Adams wrote:
I need to understand the
coding conventions to (a) identify and (b) work with an existing combobox
control on an existing toolbar.


With Application.CommandBars("MyToolbar")
With .Controls("MyComboBox") ' the name is the caption that pops up
MsgBox .Value & " is selected" & vbCrLf & "It is entry " & .ListIndex+1
End With
End With

If that doesn't cover what you wanted, please give more details.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Combobox on custom toolbar?

Larry Adams wrote:
By
"work with an existing combo box control", I was mostly looking for a good
summary of what properties and methods apply specifically to toolbars and
toolbar controls.


Look in the object browser for CommandBarComboBox

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

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
custom toolbar dml Excel Discussion (Misc queries) 1 March 17th 10 02:02 PM
VBA custom toolbar donwb Excel Discussion (Misc queries) 0 December 28th 09 01:15 AM
Custom Toolbar user Excel Discussion (Misc queries) 1 March 17th 09 05:33 AM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
saving toolbar buttons on custom toolbar Paul James Excel Programming 12 August 6th 03 08:28 AM


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