Placing dialog box to the right of the screen

P

PPL

Hi,
I'm writing some VBA to place a series of dialog boxes that I want to
position at the top right hand side of the screen.
Furthermore I'm using the following line to minimize Word 2000 so that I
only see the dialog box
Application.WindowState = wdWindowStateMinimize

Looking at the positioning of the box I've tried the following lines
Me.Left = Application.Width - Me.Width
and
Me.Left = System.HorizontalResolution - Me.Width

Neither of these instructions position the box to the right hand side of the
screen. Both seem to push the box too far to the right?
Has anyone found a similar problem and a solution ?

TIA

Phil
 
H

Helmut Weber

Hi PPL,
Has anyone found a similar problem and a solution ?

1st: yes.
2nd: no.

Very strange.

Private Sub UserForm_Activate()
Me.Left = System.VerticalResolution - Me.Width
End Sub

For 1024 x 768 pixels this is working fine,
to the single pixel!
Yes, of course. What has VerticalResolution to do with it?
Nothing!

Coincidence or causality?

My usual explanantion is that
someone at MSFT has poured a cup of coffee into the keyboard
at the wrong time or
wanted to go home for viewing the superbowl final.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
P

PPL

Hey Helmut,
You are a clever guy.
Well done. Yes it seems to work fine.
You have saved me hours and hours of messing around. Thank you so much.

PPL
 
T

Tony Jollans

Coincidence or causality?

Coincidence. And it depends on your monitor.

System.HorizontalResolution is 1024 *pixels*

At 96 dpi (and with 72 points per inch) this is 768 *points*
System.VerticalResolution = 768 *pixels*

It's not quite that simple but you get the idea?
 
L

Lene Fredborg

You can use System.HorizontalResolution. However, since
System.HorizontalResolution returns a value in pixels whereas Me.Width
returns a value in points, you need to convert to the same unit of
measurement:

Me.Left = PixelsToPoints(System.HorizontalResolution) - Me.Width

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top