Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default 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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I have some code which loads a form in Excel on startup vbnewbie Excel Programming 2 May 5th 09 04:38 PM
How do I create startup boxes that once answered appear in a form Excel boxes help Excel Worksheet Functions 1 March 12th 09 11:07 AM
Custom User Form At Startup FARAZ QURESHI Excel Discussion (Misc queries) 1 May 8th 08 12:02 PM
Loading Form on Startup II nca-wom Excel Programming 1 April 1st 05 03:22 PM
Displaying form on startup? PEno1 Excel Programming 2 December 6th 04 02:09 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"