ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Form Startup Position (https://www.excelbanter.com/excel-programming/429171-form-startup-position.html)

kirkm[_8_]

Form Startup Position
 

If you've changed a Forms Height, Top etc. is there any way
to restore the design time defaults, without closing the Form and
opening it again?

Specifically I'm trying to force it back to center (StartupPosition =
1, Form Top = 0) after it's expanded, then shrunk again.

Thanks - Kirk




Peter T

Form Startup Position
 
With APIs you can work out the pixel size of the screen and the form and
center accordingly. However for your needs probably OK to simply trap and
restore its coordinates

' click the form
Private mLt As Single, mTp As Single

Private Sub UserForm_Activate()
With Me
mLt = .Left
mTp = Top
End With
End Sub

Private Sub UserForm_Click()
Static b As Boolean
With Me
.Left = IIf(b, mLt, 20)
.Top = IIf(b, mTp, 20)
End With
b = Not b
End Sub


Regards,
Peter T

<kirkm wrote in message ...

If you've changed a Forms Height, Top etc. is there any way
to restore the design time defaults, without closing the Form and
opening it again?

Specifically I'm trying to force it back to center (StartupPosition =
1, Form Top = 0) after it's expanded, then shrunk again.

Thanks - Kirk






royUK[_125_]

Form Startup Position
 

Check out 'Chip Pearson's'
(http://www.cpearson.com/excel/FormPosition.htm) solution.


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=101864


Tim Zych

Form Startup Position
 
Or, store the values when the form is first opened, do whatever you want
with the form, then reset using the stored values.

--
Regards,
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility

<kirkm wrote in message ...

If you've changed a Forms Height, Top etc. is there any way
to restore the design time defaults, without closing the Form and
opening it again?

Specifically I'm trying to force it back to center (StartupPosition =
1, Form Top = 0) after it's expanded, then shrunk again.

Thanks - Kirk







All times are GMT +1. The time now is 04:07 PM.

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