Results 1 to 6 of 6

Controls on the toolbox

This is a discussion on Controls on the toolbox within the Excel Questions forums, part of the Question Forums category; Hey Just wanted to find out how do you insert VB code for controls on the toolbox such as list ...

  1. #1
    New Member
    Join Date
    Mar 2004
    Posts
    31

    Default Controls on the toolbox

    Hey
    Just wanted to find out how do you insert VB code for controls on the toolbox such as list box, combo box, scroll bar etc etc
    Anyone know the basic code and then i can fill in the rest for example if i add a list box to a form how do i enter the text which should appear on that aboject?
    thanks

  2. #2
    New Member pricejj's Avatar
    Join Date
    Mar 2004
    Location
    Ann Arbor ain't no place for a Buckeye!
    Posts
    42

    Default Re: Controls on the toolbox

    A Right Mouse click on any object will allow you to get into the properties of that object. Right Mouse click and select Properties

  3. #3
    New Member
    Join Date
    Mar 2004
    Posts
    31

    Default Re: Controls on the toolbox

    Hello
    Yeah but if you have a list box where in the properties do you fill in what text you want to be listed? And where do you fill in text for the other control objects in the toolbox?
    thanks

  4. #4
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling
    Posts
    64,939

    Default

    Double click on an object and the VB editor will open and it will show the default event procedure for that control.

    e.g. if you double click on a combobox you will get this

    Code:
    Private Sub ComboBox1_Change()
    
    End Sub
    If posting code please use code tags.

  5. #5
    New Member
    Join Date
    Mar 2004
    Posts
    31

    Default Re: Controls on the toolbox

    hello
    yeah that appears but then what do you type inbetween
    so that the text you want listed appears?

    Eg:
    Private Sub ListBox1_Click()
    blue,yellow,green,red (text i want in list) (is this how you type it)
    End Sub



  6. #6
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling
    Posts
    64,939

    Default

    The RowSource property of a listbox will set what is listed.

    It will accept an Excel range.

    Or use the AddItem method

    E.G. Listbox1.AddItem "Blue" etc

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com