ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform, StartUpPosition (https://www.excelbanter.com/excel-programming/381374-userform-startupposition.html)

Peter Ostermann

userform, StartUpPosition
 
Hi folks,

to position a user form rightmost on the monitor
I miss a preset constant for the property
StartUpPosition aside of 'manual', 'centerowner',
'centerscreen' and 'windows default'.

To set 'left' manually by a program-function at least
I need to detect the screenwidth of the present monitor
but do not know how.

Can somebody help me out, maybe even with a
code example right away (for not to invent the wheel
again :-) )?
Thanks.

Regards
Peter






Ken

userform, StartUpPosition
 
Peter

The following is code I got from this group and use a lot:

Application.WindowState = xlMaximized
Me.Top = 0
Me.Left = 0
Me.Height = Application.Height
Me.Width = Application.Width

Of course it does not do exactly what you want, but, I think it could
get you started. To position a userform to the right, you could go
with

Me.Left=Application.Width - Me.Width

and

Me.Left=0

will put it on the left. The maximizing statement may or may not be
relevant to your situation.

Good luck.

Ken
Norfolk, Va



Peter Ostermann wrote:
Hi folks,

to position a user form rightmost on the monitor
I miss a preset constant for the property
StartUpPosition aside of 'manual', 'centerowner',
'centerscreen' and 'windows default'.

To set 'left' manually by a program-function at least
I need to detect the screenwidth of the present monitor
but do not know how.

Can somebody help me out, maybe even with a
code example right away (for not to invent the wheel
again :-) )?
Thanks.

Regards
Peter



Peter Ostermann

userform, StartUpPosition
 
Hi John,

thanks for the hint, but....

"John Bundy" (remove) wrote

This returns the vakue for the msoScreenSize, just search for what each
value
represents

MsgBox Application.DefaultWebOptions.ScreenSize


....... using that statement it returns "3", what ever that means.

Regards
Peter





-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"Peter Ostermann" wrote:

Hi folks,

to position a user form rightmost on the monitor
I miss a preset constant for the property
StartUpPosition aside of 'manual', 'centerowner',
'centerscreen' and 'windows default'.

To set 'left' manually by a program-function at least
I need to detect the screenwidth of the present monitor
but do not know how.

Can somebody help me out, maybe even with a
code example right away (for not to invent the wheel
again :-) )?
Thanks.

Regards
Peter









Peter Ostermann

userform, StartUpPosition
 
Hi Ken,

you gave exactly the hint what I was looking for!
Thanks.

"Ken" wrote

Me.Left=Application.Width - Me.Width


Good luck.

Ken
Norfolk, Va

Greetings to Norfolk. I have
good memories to that place.

Peter
Oldenburg, NW-Germany
www.pkf-ostermann.de




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com