J
Jean-Guy Marcil
Hi there,
I have a macro that calculates the vertical length of the currently selected
range, if this selection in within a single page.
I use something like:
With rgeCurrent
.Paragraphs(1).Range.Characters(1) _
.Information(wdVerticalPositionRelativeToPage)
End With
Where rgeCurrent is a range.
But, when the range is within a table, I found that the only way to get
reliable measurements was to use "wdVerticalPositionRelativeToTextBoundary"
instead of "wdVerticalPositionRelativeToPage". But, in such case I get
results relative to the cell holding the range.
Problem:
How to calculate the length of a selection that encompasses many cells?
"wdVerticalPositionRelativeToTextBoundary" at the end of the range returns
the position of the end of the range relative to the cell holding the end of
the range. So I cannot get the full length of the range by adding the
starting and ending position like I do outside of tables with
"wdVerticalPositionRelativeToPage".
I can think of a few ways around that, but they are quite involved and may
possibly not work if there are merged cells...
It is very possible that I have overlooked or misused something...
Does anybody know how to get the vertical length of a range in tables.
And what if the range starts outside a table and finishes in a table (or
vice cersa)?
I have a macro that calculates the vertical length of the currently selected
range, if this selection in within a single page.
I use something like:
With rgeCurrent
.Paragraphs(1).Range.Characters(1) _
.Information(wdVerticalPositionRelativeToPage)
End With
Where rgeCurrent is a range.
But, when the range is within a table, I found that the only way to get
reliable measurements was to use "wdVerticalPositionRelativeToTextBoundary"
instead of "wdVerticalPositionRelativeToPage". But, in such case I get
results relative to the cell holding the range.
Problem:
How to calculate the length of a selection that encompasses many cells?
"wdVerticalPositionRelativeToTextBoundary" at the end of the range returns
the position of the end of the range relative to the cell holding the end of
the range. So I cannot get the full length of the range by adding the
starting and ending position like I do outside of tables with
"wdVerticalPositionRelativeToPage".
I can think of a few ways around that, but they are quite involved and may
possibly not work if there are merged cells...
It is very possible that I have overlooked or misused something...
Does anybody know how to get the vertical length of a range in tables.
And what if the range starts outside a table and finishes in a table (or
vice cersa)?