none
Outlook 2013 - VBA Listbox not populating RRS feed

  • Question

  • Hi.

    I am trying to set up a userform to populate with the data from an array.  Before getting to the array part, I wanted to try populating my listbox with a few simple text lines.

    The code below brings up the userform but doesn't populate.  I must be missing someting.

    Option Explicit
    
    Private Sub cmdCancel_Click()
    
    Me.Hide
    
    End Sub
    
    Private Sub cmdOK_Click()
    
    MsgBox "You have just clicked OK!"
    
    Me.Hide
    
    End Sub
    
    Private Sub UserForm_Intialize()
    
        ListBox1.AddItem "Sample Request"
        ListBox1.AddItem "Product Return"
        ListBox1.AddItem "Quote Request"
    
    End Sub
    

    Thanks.

    Thursday, February 25, 2016 9:49 PM

Answers

  • You've mis-spelled initialize.  It should be...

    Private Sub UserForm_Initialize()

    Hope this helps!


    Domenic Tamburino Microsoft MVP - Excel xl-central.com - "For Your Microsoft Excel Solutions"

    • Marked as answer by Exiled_In_CA Thursday, February 25, 2016 10:08 PM
    Thursday, February 25, 2016 10:03 PM

All replies

  • You've mis-spelled initialize.  It should be...

    Private Sub UserForm_Initialize()

    Hope this helps!


    Domenic Tamburino Microsoft MVP - Excel xl-central.com - "For Your Microsoft Excel Solutions"

    • Marked as answer by Exiled_In_CA Thursday, February 25, 2016 10:08 PM
    Thursday, February 25, 2016 10:03 PM
  • You should select Userform1 from the dropdown list above/left the code window (object select) , and Initialize from the above/right dropdown (procedure select), and you will never have a spelling error - Initialize is the correct spelling.

    Private Sub UserForm_Intialize()

    " I must be missing someting."  - like the "h" in something....  ;-)

    Thursday, February 25, 2016 10:09 PM
  • You should select Userform1 from the dropdown list above/left the code window (object select) , and Initialize from the above/right dropdown (procedure select), and you will never have a spelling error - Initialize is the correct spelling.

    Private Sub UserForm_Intialize()

    " I must be missing someting."  - like the "h" in something....  ;-)

    Yes, I am victim of my own poor typing and proofing skills.  Don't want to say how much time I wasted on this.
    Thursday, February 25, 2016 10:24 PM