Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2007

Tip: Looking for answers? Try searching our database.

Placing dialog box to the right of the screen

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PPL - 25 Mar 2007 14:44 GMT
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
Helmut Weber - 25 Mar 2007 20:15 GMT
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.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

PPL - 25 Mar 2007 21:43 GMT
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

> Hi PPL,
>
[quoted text clipped - 20 lines]
> at the wrong time or
> wanted to go home for viewing the superbowl final.
Tony Jollans - 26 Mar 2007 00:08 GMT
> 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?

Signature

Enjoy,
Tony

> Hi PPL,
>
[quoted text clipped - 20 lines]
> at the wrong time or
> wanted to go home for viewing the superbowl final.
Helmut Weber - 26 Mar 2007 08:39 GMT
Thank you Tony,

1024 / 96 * 72 ' !

--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000 (german versions)
Lene Fredborg - 28 Mar 2007 00:18 GMT
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

Signature

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

> Hi,
> I'm writing some VBA to place a series of dialog boxes that I want to
[quoted text clipped - 15 lines]
>
> Phil
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.