Delay when userform resizes??

R

Robert Crandal

I created a Userform that has on command button on
top. When the command button is pressed, my code
will toggle/resize the Userform's height between 100
and 200 pixels.

I notice that sometimes when I press the command
button to initiate a resize subroutine that userform will
not always immediately resize. It's almost as if the
button press event gets lost or the resize fails. Why
is there sometimes a delay or lack of resize when
a command button is pressed??

BTW, when the command button is pressed I will
usually just run the following code:

UserForm1.Height = 100 ' or 200

thank u
 
J

Jacob Skaria

--Do you have any code written in the Resize event ...
Private Sub UserForm_Resize()

End Sub

--Try using the Repaint method. If the contents or appearance of an object
changes significantly, and you don't want to wait until the system
automatically repaints the area.

Private Sub CommandButton1_Click()
UserForm1.Height = 100
UserForm1.Repaint
End Sub
 
R

Robert Crandal

No, I dont have code in the Userform_Resize() event. My userform
cannot be resized by mouse. I am only allowing them to pick
two different userform sizes, which are toggled with a command button.
Am I supposed to put code in there???

The .Repaint method seems to be what I'm looking for. However, it
seems like the dimensions will not change if I press the command
button repeatedly to toggle between sizes in a fast manner. I know
this isn't important, but I just expect the form to always resize itself
immediately when the button is pressed. 8(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top