Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Forms and screens

How can I make sure the edges of a form never go beyond the edge of the screen.
This permits the form edges to be hidden until the mousebutton is released.

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Userform.Left < 0 then Userform.Left = 0
If Userform.Top < 0 then Userform.Top = 0
End Sub

T.I.A.
Geoff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Forms and screens

Private Sub UserForm_Layout()
If UserForm.Left < 0 Then UserForm.Left = 0
If UserForm.Top < 0 Then UserForm.Top = 0
End Sub

Will need a bit more work to deal with the bottom and right edge of the
screen.

RBS


"Geoff" wrote in message
...
How can I make sure the edges of a form never go beyond the edge of the
screen.
This permits the form edges to be hidden until the mousebutton is
released.

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Userform.Left < 0 then Userform.Left = 0
If Userform.Top < 0 then Userform.Top = 0
End Sub

T.I.A.
Geoff


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Forms and screens

Thank you.
I can calculate the right and bottom edges ok converting screen pixels to
points etc. It was the Layout event I was unaware of.

Geoff

"RB Smissaert" wrote:

Private Sub UserForm_Layout()
If UserForm.Left < 0 Then UserForm.Left = 0
If UserForm.Top < 0 Then UserForm.Top = 0
End Sub

Will need a bit more work to deal with the bottom and right edge of the
screen.

RBS


"Geoff" wrote in message
...
How can I make sure the edges of a form never go beyond the edge of the
screen.
This permits the form edges to be hidden until the mousebutton is
released.

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Userform.Left < 0 then Userform.Left = 0
If Userform.Top < 0 then Userform.Top = 0
End Sub

T.I.A.
Geoff



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
dual screens wm Excel Discussion (Misc queries) 1 November 8th 05 07:36 PM
Linked screens? P.B. de Bruijn Excel Discussion (Misc queries) 0 October 22nd 05 07:04 PM
Two Screens??? Wayne Excel Discussion (Misc queries) 1 December 23rd 04 07:48 PM
Best Way to Create Help Screens for Excel Forms Bob Kaku Excel Programming 3 September 17th 03 08:47 PM
Pop Up Screens Darren O'Connell Excel Programming 3 July 18th 03 02:51 PM


All times are GMT +1. The time now is 03:14 PM.

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

About Us

"It's about Microsoft Excel"