+ Reply to Thread
Results 1 to 8 of 8

combo box beginner question...

Hybrid View

  1. #1
    thomas
    Guest

    combo box beginner question...

    I've tried to find how to make choices in a combo box but had no luck. This
    is the code I wrote, but it doesn't show up in the combo box:


    Private Sub Internet_Change()
    With Internet
    AddItem "A"
    AddItem "B"
    End With
    End Sub


    Why doesn't this show up when form is ran???
    Thanks ahead of time,
    Tom

  2. #2
    Tom Ogilvy
    Guest

    Re: combo box beginner question...

    Private Sub Userform_Initialize()
    With Me.Internet
    AddItem "A"
    AddItem "B"
    End With
    End Sub

    If internet is the name of the combobox, it isn't going to change unless you
    type something in it or you make a selection - I doubt that is what you
    want, so put your code in the Initialize event of the Userform. This should
    be in the userform module( select the events from the dropdowns at the top
    of the module to make sure they are declared correctly).

    --
    Regards,
    Tom Ogilvy


    "thomas" <thomas@discussions.microsoft.com> wrote in message
    news:B6F3F128-6362-4677-AC8C-14C59EB02812@microsoft.com...
    > I've tried to find how to make choices in a combo box but had no luck.

    This
    > is the code I wrote, but it doesn't show up in the combo box:
    >
    >
    > Private Sub Internet_Change()
    > With Internet
    > AddItem "A"
    > AddItem "B"
    > End With
    > End Sub
    >
    >
    > Why doesn't this show up when form is ran???
    > Thanks ahead of time,
    > Tom




  3. #3
    thomas
    Guest

    Re: combo box beginner question...

    That's a big help for me. I notice you answer a lot of people's questions, do
    you work for Microsoft...No need to answer if to busy.
    Thanks for the help

    "Tom Ogilvy" wrote:

    > Private Sub Userform_Initialize()
    > With Me.Internet
    > AddItem "A"
    > AddItem "B"
    > End With
    > End Sub
    >
    > If internet is the name of the combobox, it isn't going to change unless you
    > type something in it or you make a selection - I doubt that is what you
    > want, so put your code in the Initialize event of the Userform. This should
    > be in the userform module( select the events from the dropdowns at the top
    > of the module to make sure they are declared correctly).
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "thomas" <thomas@discussions.microsoft.com> wrote in message
    > news:B6F3F128-6362-4677-AC8C-14C59EB02812@microsoft.com...
    > > I've tried to find how to make choices in a combo box but had no luck.

    > This
    > > is the code I wrote, but it doesn't show up in the combo box:
    > >
    > >
    > > Private Sub Internet_Change()
    > > With Internet
    > > AddItem "A"
    > > AddItem "B"
    > > End With
    > > End Sub
    > >
    > >
    > > Why doesn't this show up when form is ran???
    > > Thanks ahead of time,
    > > Tom

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: combo box beginner question...

    You will see very few answers from Microsoft Employees. These are primarily
    peer to peer support. Those MS employees that do answer indicate they are
    employees with something like

    Buddy Rich [MSFT]

    or
    Buddy Rich [MS]

    or something similar.

    So, no I am not a microsoft employee.

    --
    Regards,
    Tom Ogilvy

    "thomas" <thomas@discussions.microsoft.com> wrote in message
    news:3BE3F368-2A9F-4945-858A-D77D73CF8439@microsoft.com...
    > That's a big help for me. I notice you answer a lot of people's questions,

    do
    > you work for Microsoft...No need to answer if to busy.
    > Thanks for the help
    >
    > "Tom Ogilvy" wrote:
    >
    > > Private Sub Userform_Initialize()
    > > With Me.Internet
    > > AddItem "A"
    > > AddItem "B"
    > > End With
    > > End Sub
    > >
    > > If internet is the name of the combobox, it isn't going to change unless

    you
    > > type something in it or you make a selection - I doubt that is what you
    > > want, so put your code in the Initialize event of the Userform. This

    should
    > > be in the userform module( select the events from the dropdowns at the

    top
    > > of the module to make sure they are declared correctly).
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "thomas" <thomas@discussions.microsoft.com> wrote in message
    > > news:B6F3F128-6362-4677-AC8C-14C59EB02812@microsoft.com...
    > > > I've tried to find how to make choices in a combo box but had no luck.

    > > This
    > > > is the code I wrote, but it doesn't show up in the combo box:
    > > >
    > > >
    > > > Private Sub Internet_Change()
    > > > With Internet
    > > > AddItem "A"
    > > > AddItem "B"
    > > > End With
    > > > End Sub
    > > >
    > > >
    > > > Why doesn't this show up when form is ran???
    > > > Thanks ahead of time,
    > > > Tom

    > >
    > >
    > >




  5. #5
    Tom Ogilvy
    Guest

    Re: combo box beginner question...

    for completeness - as Norman Jones pointed out, the AddItems need to be
    ..AddItems with a period to show they are qualified by Me.Internet

    Private Sub Userform_Initialize()
    With Me.Internet
    .AddItem "A"
    .AddItem "B"
    End With
    End Sub

    --
    Regards,
    Tom Ogilvy

    "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    news:uo$RwNtkFHA.1044@tk2msftngp13.phx.gbl...
    > You will see very few answers from Microsoft Employees. These are

    primarily
    > peer to peer support. Those MS employees that do answer indicate they

    are
    > employees with something like
    >
    > Buddy Rich [MSFT]
    >
    > or
    > Buddy Rich [MS]
    >
    > or something similar.
    >
    > So, no I am not a microsoft employee.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "thomas" <thomas@discussions.microsoft.com> wrote in message
    > news:3BE3F368-2A9F-4945-858A-D77D73CF8439@microsoft.com...
    > > That's a big help for me. I notice you answer a lot of people's

    questions,
    > do
    > > you work for Microsoft...No need to answer if to busy.
    > > Thanks for the help
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > Private Sub Userform_Initialize()
    > > > With Me.Internet
    > > > AddItem "A"
    > > > AddItem "B"
    > > > End With
    > > > End Sub
    > > >
    > > > If internet is the name of the combobox, it isn't going to change

    unless
    > you
    > > > type something in it or you make a selection - I doubt that is what

    you
    > > > want, so put your code in the Initialize event of the Userform. This

    > should
    > > > be in the userform module( select the events from the dropdowns at the

    > top
    > > > of the module to make sure they are declared correctly).
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > >
    > > > "thomas" <thomas@discussions.microsoft.com> wrote in message
    > > > news:B6F3F128-6362-4677-AC8C-14C59EB02812@microsoft.com...
    > > > > I've tried to find how to make choices in a combo box but had no

    luck.
    > > > This
    > > > > is the code I wrote, but it doesn't show up in the combo box:
    > > > >
    > > > >
    > > > > Private Sub Internet_Change()
    > > > > With Internet
    > > > > AddItem "A"
    > > > > AddItem "B"
    > > > > End With
    > > > > End Sub
    > > > >
    > > > >
    > > > > Why doesn't this show up when form is ran???
    > > > > Thanks ahead of time,
    > > > > Tom
    > > >
    > > >
    > > >

    >
    >




  6. #6
    moi
    Guest

    Re: combo box beginner question...

    AddItem is correct, but not in the Change-event.
    It seems to me you start with an empty combo, so it's value can never be
    changed if it's empty.
    In Visual Basic Editor, double click on ThisWorbook in your Project Explorer
    on the left.
    Then, copycat the following piece of code:

    Private Sub Workbook_Open()
    Sheets(1).ComboBox1.AddItem "A"
    Sheets(1).ComboBox1.AddItem "B"
    End Sub



    "thomas" <thomas@discussions.microsoft.com> schreef in bericht
    news:B6F3F128-6362-4677-AC8C-14C59EB02812@microsoft.com...
    > I've tried to find how to make choices in a combo box but had no luck.
    > This
    > is the code I wrote, but it doesn't show up in the combo box:
    >
    >
    > Private Sub Internet_Change()
    > With Internet
    > AddItem "A"
    > AddItem "B"
    > End With
    > End Sub
    >
    >
    > Why doesn't this show up when form is ran???
    > Thanks ahead of time,
    > Tom




  7. #7
    Norman Jones
    Guest

    Re: combo box beginner question...

    Hi Thomas,

    In additiion to Tom's suggestion.

    Change the lines:

    > AddItem "A"
    > AddItem "B"

    to:
    > . AddItem "A"
    > .AddItem "B"


    (Prepend with .)

    ---
    Regards,
    Norman



    "thomas" <thomas@discussions.microsoft.com> wrote in message
    news:B6F3F128-6362-4677-AC8C-14C59EB02812@microsoft.com...
    > I've tried to find how to make choices in a combo box but had no luck.
    > This
    > is the code I wrote, but it doesn't show up in the combo box:
    >
    >
    > Private Sub Internet_Change()
    > With Internet
    > AddItem "A"
    > AddItem "B"
    > End With
    > End Sub
    >
    >
    > Why doesn't this show up when form is ran???
    > Thanks ahead of time,
    > Tom




  8. #8
    Tom Ogilvy
    Guest

    Re: combo box beginner question...

    Good catch. Thanks.

    --
    Regards,
    Tom Ogilvy



    "Norman Jones" <normanjones@whereforartthou.com> wrote in message
    news:Og$1UFtkFHA.3448@TK2MSFTNGP12.phx.gbl...
    > Hi Thomas,
    >
    > In additiion to Tom's suggestion.
    >
    > Change the lines:
    >
    > > AddItem "A"
    > > AddItem "B"

    > to:
    > > . AddItem "A"
    > > .AddItem "B"

    >
    > (Prepend with .)
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "thomas" <thomas@discussions.microsoft.com> wrote in message
    > news:B6F3F128-6362-4677-AC8C-14C59EB02812@microsoft.com...
    > > I've tried to find how to make choices in a combo box but had no luck.
    > > This
    > > is the code I wrote, but it doesn't show up in the combo box:
    > >
    > >
    > > Private Sub Internet_Change()
    > > With Internet
    > > AddItem "A"
    > > AddItem "B"
    > > End With
    > > End Sub
    > >
    > >
    > > Why doesn't this show up when form is ran???
    > > Thanks ahead of time,
    > > Tom

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1