Solved

vertical position relative to page

Posted on 2002-07-09
4
391 Views
Last Modified: 2008-02-01
Does anyone know how to use

wdverticalPositionRelativeToPage?

I've tried it on the following line of code

msgbox Selection.Inormation(wdVerticalPositionRelativeToPage)
 
I was hoping it might tell me the current position of the selection. Instead it returns a -1 which means it is not visible.

How do I get this to work properly. It really is important.

Jerome


0
Comment
Question by:jcherry_99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
hes earned 50 total points
ID: 7141716
Selection.Information(wdVerticalPositionRelativeToPage) does not return the correct value unless you are in Page view. In Normal view, it returns the distance from the top margin.

Always set the view to be Page view, with Magnification set to 100%, before using the Information property to get the cursor position.
0
 
LVL 5

Expert Comment

by:rpai
ID: 7141763
Dim objapp As New Word.Application

objapp.Documents.Open ("C:\Test.doc")
objapp.Visible = True
Debug.Print objapp.Selection.Information(wdVerticalPositionRelativeToPage)
0
 

Author Comment

by:jcherry_99
ID: 7145082
Thank you. This problem has been driving me (and others) nuts for quite awhile. All you have to do to insure that it is in page view is add a couple of lines and insure that the it is in the proper place. I was never to see a number other than -1 in my life.

The real question is to measure the change in height of a cell in a table. To do that, all you have to do is measure the change in selections from the top of the table to the bottom and subtract everytime you change something within the table. That question caused so much trouble that it was eventually deleted. I put it up again and got no response until I asked this question. It's great to have an answer.

Jerome.
0
 

Author Comment

by:jcherry_99
ID: 7145088
I tried the second comment I got and though interesting, I could not get it to work. Furthermore, I did not like the idea of a file being created. Were you using Word? Word 97's vba simply did not work the way I wanted it to. I wanted it to go within the current document and it did not.

Jerome.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question