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.
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.
Try this
http://www.cpearson.com/excel/FormPosition.htm
--
HTH
Bob Phillips
"OKLover" <[email protected]> wrote in message
news:%[email protected]...
> 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.
>
>
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" <[email protected]> skrev i melding
news:%[email protected]...
> 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.
>
Thanks to Bob and Harald, i will try it. :D
"OKLover" <[email protected]> 写入消息新闻:%[email protected]...
> 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.
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks