Solved

vertical position relative to page

Posted on 2002-07-09
4
385 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
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now