In a macro, the value returned by
"Selection.Information(wdHorizontalPosition..." and
"Selection.Information(wdVerticalPosition...)" is in points, even though the
help says the value is in twips. I assume that the function is accurate.
Should the returned value be rounded or truncated or used exactly as
returned? For example, if a paragraph is indented 0.5 inches, the returned
value is 36.0 points which computes to an actual indent of 0.5 inches.
However, if the paragraph is indented 0.25 inches, the returned value is
18.45 points which computes to exactly 0.25625 inches.
Can Word actually do its metrics in fractions of points and, for that
matter, in fractions of twips? When returned values are converted to twips,
occassionally the answer is in fractions of twips. I have double- and
triple-checked the calculations and for multiples of 1/2 inch (0.0, 0.5, 1.0,
etc.), the results are always perfect.
Thanks for your help.

Re: Points returned by Information(wdHorizontalPosition...) by Jezebel

Jezebel
Mon Oct 24 07:24:17 CDT 2005

You've misread the Help file. Information() returns points, not twips ...

wdHorizontalPositionRelativeToPage Returns the horizontal position of the
specified selection or range; this is the distance from the left edge of the
selection or range to the left edge of the page measured in points (1 point
= 20 twips, 72 points = 1 inch). If the selection or range isn't within the
screen area, returns - 1.

wdVerticalPositionRelativeToPage Returns the vertical position of the
selection or range; this is the distance from the top edge of the selection
to the top edge of the page measured in points (1 point = 20 twips, 72
points = 1 inch). If the selection isn't visible in the document window,
returns - 1.


Separately, I think there must be something interfering with your
positioning, rather than internal conversion problems. I normally work in
millimetres (so these measurements are never exact); but I just tried
changing to inches and setting the margin to 0.25 inches.
selection.Information(wdHorizontalPositionRelativeToPage) returns exactly
18, as expected.





"Charlie''s Word VBA questions"
<CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
news:5B984BAC-ADE3-4467-B97B-FEF51711A4C0@microsoft.com...
> In a macro, the value returned by
> "Selection.Information(wdHorizontalPosition..." and
> "Selection.Information(wdVerticalPosition...)" is in points, even though
> the
> help says the value is in twips. I assume that the function is accurate.
> Should the returned value be rounded or truncated or used exactly as
> returned? For example, if a paragraph is indented 0.5 inches, the
> returned
> value is 36.0 points which computes to an actual indent of 0.5 inches.
> However, if the paragraph is indented 0.25 inches, the returned value is
> 18.45 points which computes to exactly 0.25625 inches.
> Can Word actually do its metrics in fractions of points and, for that
> matter, in fractions of twips? When returned values are converted to
> twips,
> occassionally the answer is in fractions of twips. I have double- and
> triple-checked the calculations and for multiples of 1/2 inch (0.0, 0.5,
> 1.0,
> etc.), the results are always perfect.
> Thanks for your help.



Re: Points returned by Information(wdHorizontalPosition...) by CharliesWordVBAquestions

CharliesWordVBAquestions
Mon Oct 24 15:25:02 CDT 2005

Yes, I misread the Help. Thank you.
I did some more experimenting with this. I would bet that in your test, the
zoom was 100%. If you change the zoom to, say, 90%, the number of points
will be 18.45 in the paragraph is indented .25 inches.

"Jezebel" wrote:

> You've misread the Help file. Information() returns points, not twips ...
>
> wdHorizontalPositionRelativeToPage Returns the horizontal position of the
> specified selection or range; this is the distance from the left edge of the
> selection or range to the left edge of the page measured in points (1 point
> = 20 twips, 72 points = 1 inch). If the selection or range isn't within the
> screen area, returns - 1.
>
> wdVerticalPositionRelativeToPage Returns the vertical position of the
> selection or range; this is the distance from the top edge of the selection
> to the top edge of the page measured in points (1 point = 20 twips, 72
> points = 1 inch). If the selection isn't visible in the document window,
> returns - 1.
>
>
> Separately, I think there must be something interfering with your
> positioning, rather than internal conversion problems. I normally work in
> millimetres (so these measurements are never exact); but I just tried
> changing to inches and setting the margin to 0.25 inches.
> selection.Information(wdHorizontalPositionRelativeToPage) returns exactly
> 18, as expected.
>
>
>
>
>
> "Charlie''s Word VBA questions"
> <CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
> news:5B984BAC-ADE3-4467-B97B-FEF51711A4C0@microsoft.com...
> > In a macro, the value returned by
> > "Selection.Information(wdHorizontalPosition..." and
> > "Selection.Information(wdVerticalPosition...)" is in points, even though
> > the
> > help says the value is in twips. I assume that the function is accurate.
> > Should the returned value be rounded or truncated or used exactly as
> > returned? For example, if a paragraph is indented 0.5 inches, the
> > returned
> > value is 36.0 points which computes to an actual indent of 0.5 inches.
> > However, if the paragraph is indented 0.25 inches, the returned value is
> > 18.45 points which computes to exactly 0.25625 inches.
> > Can Word actually do its metrics in fractions of points and, for that
> > matter, in fractions of twips? When returned values are converted to
> > twips,
> > occassionally the answer is in fractions of twips. I have double- and
> > triple-checked the calculations and for multiples of 1/2 inch (0.0, 0.5,
> > 1.0,
> > etc.), the results are always perfect.
> > Thanks for your help.
>
>
>

Re: Points returned by Information(wdHorizontalPosition...) by Jezebel

Jezebel
Wed Oct 26 05:20:21 CDT 2005

You're right that Selection.Information() is affected by the zoom. I haven't
tested it in detail, but a rudimentary test shows different results.
However, that also suggests a workaround:

Selection.RANGE.Information() is *not* (it appears, again on a quick test)
affected by zoom.






"Charlie''s Word VBA questions"
<CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
news:2752C49F-210A-469B-BAB2-3F6B9198D62A@microsoft.com...
> Yes, I misread the Help. Thank you.
> I did some more experimenting with this. I would bet that in your test,
> the
> zoom was 100%. If you change the zoom to, say, 90%, the number of points
> will be 18.45 in the paragraph is indented .25 inches.
>
> "Jezebel" wrote:
>
>> You've misread the Help file. Information() returns points, not twips ...
>>
>> wdHorizontalPositionRelativeToPage Returns the horizontal position of the
>> specified selection or range; this is the distance from the left edge of
>> the
>> selection or range to the left edge of the page measured in points (1
>> point
>> = 20 twips, 72 points = 1 inch). If the selection or range isn't within
>> the
>> screen area, returns - 1.
>>
>> wdVerticalPositionRelativeToPage Returns the vertical position of the
>> selection or range; this is the distance from the top edge of the
>> selection
>> to the top edge of the page measured in points (1 point = 20 twips, 72
>> points = 1 inch). If the selection isn't visible in the document window,
>> returns - 1.
>>
>>
>> Separately, I think there must be something interfering with your
>> positioning, rather than internal conversion problems. I normally work in
>> millimetres (so these measurements are never exact); but I just tried
>> changing to inches and setting the margin to 0.25 inches.
>> selection.Information(wdHorizontalPositionRelativeToPage) returns exactly
>> 18, as expected.
>>
>>
>>
>>
>>
>> "Charlie''s Word VBA questions"
>> <CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
>> news:5B984BAC-ADE3-4467-B97B-FEF51711A4C0@microsoft.com...
>> > In a macro, the value returned by
>> > "Selection.Information(wdHorizontalPosition..." and
>> > "Selection.Information(wdVerticalPosition...)" is in points, even
>> > though
>> > the
>> > help says the value is in twips. I assume that the function is
>> > accurate.
>> > Should the returned value be rounded or truncated or used exactly as
>> > returned? For example, if a paragraph is indented 0.5 inches, the
>> > returned
>> > value is 36.0 points which computes to an actual indent of 0.5 inches.
>> > However, if the paragraph is indented 0.25 inches, the returned value
>> > is
>> > 18.45 points which computes to exactly 0.25625 inches.
>> > Can Word actually do its metrics in fractions of points and, for that
>> > matter, in fractions of twips? When returned values are converted to
>> > twips,
>> > occassionally the answer is in fractions of twips. I have double- and
>> > triple-checked the calculations and for multiples of 1/2 inch (0.0,
>> > 0.5,
>> > 1.0,
>> > etc.), the results are always perfect.
>> > Thanks for your help.
>>
>>
>>



Re: Points returned by Information(wdHorizontalPosition...) by CharliesWordVBAquestions

CharliesWordVBAquestions
Wed Oct 26 06:11:03 CDT 2005

Thank you. I had a problem with using Range, perhaps because I didn't use it
in all places I needed to. The macro I have gets the distance from the paper
left, the left margin, top of page, from top margin, from right margin, etc.
My macro executes nearly instantly, so I have used the following code. I
also use this method in other macros to get the user's settings, then restore
them when the macro ends.
'Zoom percent
CurrZoom = ActiveDocument.ActiveWindow.View.Zoom
ActiveDocument.ActiveWindow.View.Zoom = 100
---------
'Restore Zoom
ActiveDocument.ActiveWindow.View.Zoom = CurrZoom


"Jezebel" wrote:

> You're right that Selection.Information() is affected by the zoom. I haven't
> tested it in detail, but a rudimentary test shows different results.
> However, that also suggests a workaround:
>
> Selection.RANGE.Information() is *not* (it appears, again on a quick test)
> affected by zoom.
>
>
>
>
>
>
> "Charlie''s Word VBA questions"
> <CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
> news:2752C49F-210A-469B-BAB2-3F6B9198D62A@microsoft.com...
> > Yes, I misread the Help. Thank you.
> > I did some more experimenting with this. I would bet that in your test,
> > the
> > zoom was 100%. If you change the zoom to, say, 90%, the number of points
> > will be 18.45 in the paragraph is indented .25 inches.
> >
> > "Jezebel" wrote:
> >
> >> You've misread the Help file. Information() returns points, not twips ...
> >>
> >> wdHorizontalPositionRelativeToPage Returns the horizontal position of the
> >> specified selection or range; this is the distance from the left edge of
> >> the
> >> selection or range to the left edge of the page measured in points (1
> >> point
> >> = 20 twips, 72 points = 1 inch). If the selection or range isn't within
> >> the
> >> screen area, returns - 1.
> >>
> >> wdVerticalPositionRelativeToPage Returns the vertical position of the
> >> selection or range; this is the distance from the top edge of the
> >> selection
> >> to the top edge of the page measured in points (1 point = 20 twips, 72
> >> points = 1 inch). If the selection isn't visible in the document window,
> >> returns - 1.
> >>
> >>
> >> Separately, I think there must be something interfering with your
> >> positioning, rather than internal conversion problems. I normally work in
> >> millimetres (so these measurements are never exact); but I just tried
> >> changing to inches and setting the margin to 0.25 inches.
> >> selection.Information(wdHorizontalPositionRelativeToPage) returns exactly
> >> 18, as expected.
> >>
> >>
> >>
> >>
> >>
> >> "Charlie''s Word VBA questions"
> >> <CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
> >> news:5B984BAC-ADE3-4467-B97B-FEF51711A4C0@microsoft.com...
> >> > In a macro, the value returned by
> >> > "Selection.Information(wdHorizontalPosition..." and
> >> > "Selection.Information(wdVerticalPosition...)" is in points, even
> >> > though
> >> > the
> >> > help says the value is in twips. I assume that the function is
> >> > accurate.
> >> > Should the returned value be rounded or truncated or used exactly as
> >> > returned? For example, if a paragraph is indented 0.5 inches, the
> >> > returned
> >> > value is 36.0 points which computes to an actual indent of 0.5 inches.
> >> > However, if the paragraph is indented 0.25 inches, the returned value
> >> > is
> >> > 18.45 points which computes to exactly 0.25625 inches.
> >> > Can Word actually do its metrics in fractions of points and, for that
> >> > matter, in fractions of twips? When returned values are converted to
> >> > twips,
> >> > occassionally the answer is in fractions of twips. I have double- and
> >> > triple-checked the calculations and for multiples of 1/2 inch (0.0,
> >> > 0.5,
> >> > 1.0,
> >> > etc.), the results are always perfect.
> >> > Thanks for your help.
> >>
> >>
> >>
>
>
>

Re: Points returned by Information(wdHorizontalPosition...) by Jezebel

Jezebel
Thu Oct 27 04:23:00 CDT 2005

You'd do better learning to use Range objects. Almost all code runs quicker
and more reliably.




"Charlie''s Word VBA questions"
<CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
news:FF17A75F-7353-438B-B236-8969ABCD6422@microsoft.com...
> Thank you. I had a problem with using Range, perhaps because I didn't use
> it
> in all places I needed to. The macro I have gets the distance from the
> paper
> left, the left margin, top of page, from top margin, from right margin,
> etc.
> My macro executes nearly instantly, so I have used the following code. I
> also use this method in other macros to get the user's settings, then
> restore
> them when the macro ends.
> 'Zoom percent
> CurrZoom = ActiveDocument.ActiveWindow.View.Zoom
> ActiveDocument.ActiveWindow.View.Zoom = 100
> ---------
> 'Restore Zoom
> ActiveDocument.ActiveWindow.View.Zoom = CurrZoom
>
>
> "Jezebel" wrote:
>
>> You're right that Selection.Information() is affected by the zoom. I
>> haven't
>> tested it in detail, but a rudimentary test shows different results.
>> However, that also suggests a workaround:
>>
>> Selection.RANGE.Information() is *not* (it appears, again on a quick
>> test)
>> affected by zoom.
>>
>>
>>
>>
>>
>>
>> "Charlie''s Word VBA questions"
>> <CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
>> news:2752C49F-210A-469B-BAB2-3F6B9198D62A@microsoft.com...
>> > Yes, I misread the Help. Thank you.
>> > I did some more experimenting with this. I would bet that in your
>> > test,
>> > the
>> > zoom was 100%. If you change the zoom to, say, 90%, the number of
>> > points
>> > will be 18.45 in the paragraph is indented .25 inches.
>> >
>> > "Jezebel" wrote:
>> >
>> >> You've misread the Help file. Information() returns points, not twips
>> >> ...
>> >>
>> >> wdHorizontalPositionRelativeToPage Returns the horizontal position of
>> >> the
>> >> specified selection or range; this is the distance from the left edge
>> >> of
>> >> the
>> >> selection or range to the left edge of the page measured in points (1
>> >> point
>> >> = 20 twips, 72 points = 1 inch). If the selection or range isn't
>> >> within
>> >> the
>> >> screen area, returns - 1.
>> >>
>> >> wdVerticalPositionRelativeToPage Returns the vertical position of the
>> >> selection or range; this is the distance from the top edge of the
>> >> selection
>> >> to the top edge of the page measured in points (1 point = 20 twips, 72
>> >> points = 1 inch). If the selection isn't visible in the document
>> >> window,
>> >> returns - 1.
>> >>
>> >>
>> >> Separately, I think there must be something interfering with your
>> >> positioning, rather than internal conversion problems. I normally work
>> >> in
>> >> millimetres (so these measurements are never exact); but I just tried
>> >> changing to inches and setting the margin to 0.25 inches.
>> >> selection.Information(wdHorizontalPositionRelativeToPage) returns
>> >> exactly
>> >> 18, as expected.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> "Charlie''s Word VBA questions"
>> >> <CharliesWordVBAquestions@discussions.microsoft.com> wrote in message
>> >> news:5B984BAC-ADE3-4467-B97B-FEF51711A4C0@microsoft.com...
>> >> > In a macro, the value returned by
>> >> > "Selection.Information(wdHorizontalPosition..." and
>> >> > "Selection.Information(wdVerticalPosition...)" is in points, even
>> >> > though
>> >> > the
>> >> > help says the value is in twips. I assume that the function is
>> >> > accurate.
>> >> > Should the returned value be rounded or truncated or used exactly as
>> >> > returned? For example, if a paragraph is indented 0.5 inches, the
>> >> > returned
>> >> > value is 36.0 points which computes to an actual indent of 0.5
>> >> > inches.
>> >> > However, if the paragraph is indented 0.25 inches, the returned
>> >> > value
>> >> > is
>> >> > 18.45 points which computes to exactly 0.25625 inches.
>> >> > Can Word actually do its metrics in fractions of points and, for
>> >> > that
>> >> > matter, in fractions of twips? When returned values are converted
>> >> > to
>> >> > twips,
>> >> > occassionally the answer is in fractions of twips. I have double-
>> >> > and
>> >> > triple-checked the calculations and for multiples of 1/2 inch (0.0,
>> >> > 0.5,
>> >> > 1.0,
>> >> > etc.), the results are always perfect.
>> >> > Thanks for your help.
>> >>
>> >>
>> >>
>>
>>
>>