LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Save Form Position on Close


I have a userform that I've added to a spreadsheet that I've been using. It's
being used as a floating form. It can be moved anywhere on the form as the
user interacts with the spreadsheet. What I'd like to do is save the screen
position (top and left properties) when I close the form. So that the next
time the user opens the form it'll move back to the position it was in last
time.

So what I've done is I've coded the userform terminate event to write the
top and left properties to a sheet in the workbook. next time the form opens
it'll read those cells and move the form to the position saved.

Here's what I've got:

Private Sub UserForm_Terminate()

Sheets("Manning Config").Range("BU3").Value = Me.Left
Sheets("Manning Config").Range("BV3").Value = Me.Top

End Sub


The problem though is that it's writing zeros to the cells and not the
actual screen position where the form is sitting. Is the Me.Left and Me.Top
properties not the ones that I should be reading from?

Also, I haven't yet coded the form activate event yet. I'll have to have
some condition that will get the screen width and height and make sure that
the saved top and left values aren't larger than the available screen space
so that it doesn't try to open the form in a place where the user can't get
it. I think I already know how to do this part though.

 
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
Form Startup Position kirkm[_8_] Excel Programming 3 May 30th 09 05:36 PM
Form Position Steven Excel Programming 5 December 15th 08 03:06 PM
Close a form when you click outside of the form Alex St-Pierre Excel Programming 1 June 19th 08 10:57 PM
Call user form from ThisWorkbook; close file if form closed XP Excel Programming 2 July 20th 07 07:04 PM
Form start position drewdog Excel Programming 2 April 6th 04 02:15 AM


All times are GMT +1. The time now is 05:06 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"