View Full Version : Solved: Positioning UserForm In VBA :)
gecko_au2003
03-26-2005, 02:10 PM
Can anyone please help me with a module that will allow me to position a UserForm anywhere on the screen, even if it is just in certain parts of the screen, taking into consideration the end users screen dimensions ie screen width and screen height ( Resolution IE 1024 * 768, 800 * 600, etc )
So that I can place the UserForm say like so :
____________________________________
|FORM FORM FORM |
| | |
| |
|FORM FORM FORM |
| |
| |
| |
|FORM FORM FORM |
------------------------------------------
Just to give you an idea ;)
Then from there the code that specifys them points would obviously be in a module then say I wanted to place it on the top Right I would call the function , lets say it was called FormPlacement()
example call :
FormPlacement(TopRight)
Any help is very much appreciated ! Will be on :cloud9: if it is solved lol
Ken Puls
03-26-2005, 02:40 PM
Hi there, and welcome to VBAX!
You may want to go for a stroll through our KB. :yes
For the position, try Fine-Tune Userform Start Position
And for resolution, try Screen Resolution Check / Change
HTH,
JonPeltier
03-26-2005, 07:05 PM
Hi there, and welcome to VBAX!
You may want to go for a stroll through our KB. :yes
For the position, try Fine-Tune Userform Start Position
And for resolution, try Screen Resolution Check / Change
HTH,
My colleague Chip Pearson has posted a UserForm positioning module here:
http://cpearson.com/excel/FormPosition.htm
This helps to position the form in a given position with respect to a worksheet cell, or other object on a sheet. It's handy if you have a small form that aids with user input, like a date picker. It accounts for how many commandbars are visible, where the sheet has been scrolled to, etc.
About the screen resolution, I appreciate Jake's code which merely suggests the user might want to adjust their resolution, rather than trash the user's settings. (What if it's a vision-impaired user who needs 400*600 on their 17" screen? You screw with that and it's even worse than if you merely annoy a normal user with it.) But the best approach is for the programmer to adjust his forms so that they will work on any resolution. If it means you need a special multipage interface for small screens, well, it's extra work. But it's always harder to program an app that's easier to use.
Jacob Hilderbrand
03-26-2005, 07:38 PM
Top Left
Option Explicit
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = 0
Me.Left = 0
End Sub
Top Right
Option Explicit
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = 0
Me.Left = Application.Left + Application.Width - Me.Width
End Sub
Lower Left
Option Explicit
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = Application.Top + Application.Height - Me.Height
Me.Left = 0
End Sub
Lower Right
Option Explicit
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = Application.Top + Application.Height - Me.Height
Me.Left = Application.Left + Application.Width - Me.Width
End Sub
gecko_au2003
03-26-2005, 11:45 PM
Thank you all so very much ! This forum whups A$$ :) I really appreicate all the help you have all given me :) !! :thumb
There is a god : pray2:
All in a days hard work :whistle: LOL
Paleo
03-27-2005, 06:32 AM
Hi Gecko,
just dont forget to mark it solved by checking "Thread Tools" and "Mark it solved".
gecko_au2003
03-27-2005, 09:19 AM
If I do not login it , it shows me thread tools and only gives me the options to print it off or email it. So I logged in and now it doesnt even give me thread options from what I can see
nm After I posted that last message it gave me the option :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.