Results 1 to 3 of 3
  1. #1
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Erratic behavior modifying UserForm control height (Word 2002 SP-2)

    I've got a Word UserForm with 2 listboxes. In between Loading the form and Showing it, I set the Height of each listbox to correspond to the number of items in the list.

    Listbox #2 correctly reflects the resizing but Listbox #1 stays unchanged.

    If I move the listbox resizing code to the Activate event of the UserForm, both listboxes resize properly (but the visual effect is not great).

    To add a special touch of perversity, if I insert a breakpoint in the procedure that calls the form and resizes the listboxes and then just Continue after the break, both listboxes resize properly. (I insert the breakpoint just after the lines that resize the listboxes.)

    I thought it might be a focus issue, but using .SetFocus to switch focus to the OK button before the resizing doesn't help. (Given that the UserForm isn't visible yet, I'm not sure the .SetFocus line really does anything anyway.)

    Anybody encountered this before and have a "best solution"?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Erratic behavior modifying UserForm control height (Word 2002 SP-2)

    Try inserting DoEvents after each form is resized.

    Andrew D

  3. #3
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Erratic behavior modifying UserForm control height (Word 2002 SP-2)

    <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23> Bingo! (And I note that your response hit the board 10 minutes after my post.)

    Many thanks.

Posting Permissions

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