Consulting

Results 1 to 4 of 4

Thread: Solved: Expand/Contract a User Form

  1. #1
    VBAX Tutor phendrena's Avatar
    Joined
    Oct 2008
    Location
    Huddersfield, UK
    Posts
    285
    Location

    Solved: Expand/Contract a User Form

    Hi,

    Is it possible to expand/contract a user form?

    I want the user form to display a standard set of items but i then want the user form to expand to the right and display further entry options when the user clicks a "more options" button (can use a spinner control?).

    Any suggestions on how I could do this?

    Thanks,
    Somewhere in the dark and nasty regions where nobody goes, stands an ancient castle.
    Deep within this dank and uninviting place lives Berk, overworked servant of The Thing Upstairs.
    But thats nothing compared to the horrors that lurk beneath The Trap Door.

  2. #2
    VBAX Regular
    Joined
    Jun 2008
    Posts
    72
    Location
    Here's code that allows the user the ability to resize the form....
    http://www.andypope.info/vba/resizeform.htm

    If you'd rather set the size yourself, you can manipulate the .width and .height properties of the userform.

  3. #3
    VBAX Tutor david000's Avatar
    Joined
    Mar 2007
    Location
    Chicago
    Posts
    276
    Location
    A simpler approach is to use the caption property, then toggle the height and width.
    [vba]
    Private Sub OptionsButton_Click()
    If OptionsButton.Caption = "Options >>" Then
    Me.Height = 164
    OptionsButton.Caption = "<< Options"
    Else
    Me.Height = 128
    OptionsButton.Caption = "Options >>"
    End If
    End Sub
    [/vba]
    The attachment is from John Walkenbach.

  4. #4
    VBAX Tutor phendrena's Avatar
    Joined
    Oct 2008
    Location
    Huddersfield, UK
    Posts
    285
    Location
    Quote Originally Posted by david000
    A simpler approach is to use the caption property, then toggle the height and width.
    [vba]
    Private Sub OptionsButton_Click()
    If OptionsButton.Caption = "Options >>" Then
    Me.Height = 164
    OptionsButton.Caption = "<< Options"
    Else
    Me.Height = 128
    OptionsButton.Caption = "Options >>"
    End If
    End Sub
    [/vba]
    The attachment is from John Walkenbach.
    Thats exactly what i'm looking for.
    Thank you.
    Somewhere in the dark and nasty regions where nobody goes, stands an ancient castle.
    Deep within this dank and uninviting place lives Berk, overworked servant of The Thing Upstairs.
    But thats nothing compared to the horrors that lurk beneath The Trap Door.

Posting Permissions

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