Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How to control the UserForm's position?

Hello, All

Is anyone knows how to control the UserForm's position?
It seems that i couldn't to find the Screen.Width or Screen.Height property
in VBA.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default How to control the UserForm's position?

Try this

http://www.cpearson.com/excel/FormPosition.htm

--
HTH

Bob Phillips

"OKLover" wrote in message
...
Hello, All

Is anyone knows how to control the UserForm's position?
It seems that i couldn't to find the Screen.Width or Screen.Height

property
in VBA.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default How to control the UserForm's position?

There is no Screen object like in VB, and Excel's metrics is not pixels
either -at least not all over. But this places the userform down right on my
screen, no matter what and where the Excel window is:

Declare Function GetSystemMetrics32 Lib "user32" _
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1

Sub test()
Dim X As Long, Y As Long
X = GetSystemMetrics32(SM_CXSCREEN)
Y = GetSystemMetrics32(SM_CYSCREEN)
With UserForm1
..StartUpPosition = 0
..Top = (Y - .Height - 50) * 0.71
..Left = (X - .Width - 50) * 0.71
..Show
End With
End Sub

Code modified from http://www.j-walk.com/ss/excel/tips/tip06.htm

HTH. Best wishes Harald

"OKLover" skrev i melding
...
Hello, All

Is anyone knows how to control the UserForm's position?
It seems that i couldn't to find the Screen.Width or Screen.Height
property in VBA.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How to control the UserForm's position?

Thanks to Bob and Harald, i will try it. :D


"OKLover" l...
Hello, All

Is anyone knows how to control the UserForm's position?
It seems that i couldn't to find the Screen.Width or Screen.Height
property in VBA.



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
2007 Form Control/ActiveX Control font difference Nikko963 Excel Discussion (Misc queries) 0 April 15th 09 04:21 PM
How to find UserForm's caller? PerlDev Excel Discussion (Misc queries) 1 October 24th 06 10:32 PM
RunTime Error 424 in a USERFORM's code JimP Excel Programming 0 November 26th 04 05:27 AM
control scroll position GUS Excel Programming 1 August 21st 03 10:07 PM


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