View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Userform resizing

All my controls are visible (the ones "off the form" will not be seen).

When the form shows, I want the area just down to Label1 visible, so I do
this in the initialize event. The + 21 accounts for the blue caption.
When I press CommandButton5, then the form expands down to show additional
controls. Commandbutton4 is at the bottom of the display, so I use it to
determine the new size.

Private Sub UserForm_Initialize()
UserForm1.Height = Label1.Top + _
Label1.Height + 5 + 21
End Sub
Private Sub CommandButton4_Click()
Me.Hide
End Sub

Private Sub CommandButton5_Click()
UserForm1.Height = CommandButton4.Top + _
CommandButton4.Height + 5 + 21
End Sub


--
Regards,
Tom Ogilvy

"mark leslie" wrote in message
...
So what your saying then is when a control is activated I can resize the
userform so that the "New" controls are visible? Do you have a sample
of code so I can see how to incorperate it? For instance would I use
the userform activate control or attach it to a form control?

Thanks for the swift response
Mark



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!