I can use the TextViewCursor.getPosition() method to get the Y position at end of the TextFrame text. However, this introduces a world of problems, not the least of which is the jumping around the text window does when you move the TextViewCursor from TextFrame to TextFrame.
The Y position you get is for the top of the cursor, so you have to also add the height of the last line. For some reason, the actual height added is 2 less - might be a bug. Also, the top of the cursor may not be the same as the top of the line. The only way I've found to deal with that is to use the difference between the position at the start of the text and the TextFrame position.
While TextFrame position values are from their anchor, the TextViewCursor value is from the start of the document. However, it also includes an extra amount of space per page. For an 11" page the value is 28,441 rather than 27,940 - an extra 501. Also, margins are ignored for each page except the page on which the object resides. The offset from that page is relative to the page margins.
This nasty hack can be made accurate for a specific document format, but might start losing accuracy as more format and style changes are made. The Basic algorithm for page anchored unbordered and unmargined TextFrames with fixed height lines is as follows:
Function ViewCursorY(vViewCursor As Variant)
ViewCursorY = _
vViewCursor.getPosition.Y _
- (vViewCursor.Page - 1) * PageHeight _
+ PageTopMargin
End Function...
vViewCursor.gotoRange vTextFrame.getText.getStart, false
lOffset = _
ViewCursorY(vViewCursor) _
- vTextFrame.VertOrientPosition
vViewCursor.gotoEnd false
lTextFrameHeight = _
ViewCursorY(vViewCursor) _
+ vViewCursor.ParaLineSpacing.Height - 2It works, but it sure is ugly. Hopefully, some of you will find this of some use.
-- -------------------------------------------------------- The Snake Pit - Development www.TheSnakePitDev.com Curtis Clauson [EMAIL PROTECTED] Proprietor
"Any sufficiently over-complicated magic is indistinguishable from technology." -- Llelan D.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
