ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delay when userform resizes?? (https://www.excelbanter.com/excel-programming/438933-delay-when-userform-resizes.html)

Robert Crandal

Delay when userform resizes??
 
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


Jacob Skaria

Delay when userform resizes??
 
--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



--
Jacob


"Robert Crandal" wrote:

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

.


Robert Crandal

Delay when userform resizes??
 
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(


"Jacob Skaria" wrote in message
...
--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





Jeff

Delay when userform resizes??
 
Chip Pearson's webpage has excellent near drag and drop functions to resize
forms.

"Robert Crandal" wrote:

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

.



All times are GMT +1. The time now is 09:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com