+ Reply to Thread
Results 1 to 6 of 6

.additem loading bug on userform

  1. #1
    Registered User
    Join Date
    06-26-2009
    Location
    O.o
    MS-Off Ver
    Excel 2003
    Posts
    64

    .additem loading bug on userform

    Hi guys, bit of a strange bug in my userform...
    • I have 3 combo-boxes on one of my pages (1 of 3) on my userform.
    • The items in the combo-box are added via '.additem'. There are 36 items split unevenly.
    • The page with the combo-box is the first page in the userform,
    • When I load the userform the combo-box items do not load automatically. If I move onto another page and return straight after, the items will have loaded into the combo-boxes.
    • Interestingly,when I set the non-combo-box page as the first page and call the userform - then move to the combo-box page the items will have loaded into the combo-box.

    Ideally, I would like the combo-box page to be the first when the userform is loaded and the items to load immediately into the combo-box.


    I havent attached my book, but i can do so on request if you believe it will help (sorry, being lazy to mask all private info.)

    Any ideas would be greatly appreciated. Many thanks,
    D
    Last edited by dems; 11-10-2010 at 05:30 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: .additem loading bug on userform

    We need to see the code to understand the problem, so attach an example workbook
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-26-2009
    Location
    O.o
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: .additem loading bug on userform

    Quote Originally Posted by royUK View Post
    We need to see the code to understand the problem, so attach an example workbook
    Knew i wouldnt get away with being lazy

    Please find attached Roy
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: .additem loading bug on userform

    It's not a bug, it's doing exactly what you have coded, i.e. loading the comboboxes on multipage change. The code needs to be in the initialize event of the UserForm, ot MultiPage_Change

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-26-2009
    Location
    O.o
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: .additem loading bug on userform

    HAHA brilliant - thanks Roy. Going to try avoid making that mistake in future.

    Cheers,
    Dt

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: .additem loading bug on userform

    You can avoid more....
    The months have been introduced by Excel itself; use them
    If populating multiple item use the method List.(It's also considerably faster).
    If using List you don't need the instruction Clear.

    This will produce the same result

    Please Login or Register  to view this content.
    Last edited by snb; 11-10-2010 at 06:27 AM.



+ 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