Word 2000
I want to use something other than the 3 characters provided as tab
leader options.

As an old C programmer, I outlined the algorithm I would use, but
don't know if VBA has the right methods.

If a method could return the 'length' of a line of text using a
variable width font and then subtract that from the total length
available (left margin to the leader tab), you could then divide that
length by the width of my leader character to determine how many to
insert.

I am just thinking out of the box ;-)

I imagine VBA can tell me the number of characters in a line, but for
a non-fixed-width font, that won't help. I need it in pixels, or
points, inches or some other "real" unit.

Then it would need to iterate through each line of the selection and
do the actual replacement.
Possible?

Re: Determining length of line by Jonathan

Jonathan
Thu Sep 06 08:37:25 CDT 2007


"livetohike" <moormansd@gmail.com> wrote in message
news:1189083887.007256.201070@r34g2000hsd.googlegroups.com...
> Word 2000
> I want to use something other than the 3 characters provided as tab
> leader options.
>
> As an old C programmer, I outlined the algorithm I would use, but
> don't know if VBA has the right methods.
>
> If a method could return the 'length' of a line of text using a
> variable width font and then subtract that from the total length
> available (left margin to the leader tab), you could then divide that
> length by the width of my leader character to determine how many to
> insert.
>
> I am just thinking out of the box ;-)
>
> I imagine VBA can tell me the number of characters in a line, but for
> a non-fixed-width font, that won't help. I need it in pixels, or
> points, inches or some other "real" unit.
>
> Then it would need to iterate through each line of the selection and
> do the actual replacement.
> Possible?
>

Yes, possible. You can get the horizontal position of the cursor (in points)
relative to the page by means of the
Selection.Information(wdHorizontalPositionRelativeToPage) property.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Re: Determining length of line by Helmut

Helmut
Thu Sep 06 09:11:55 CDT 2007

Hi,

Sub Test5bb()
Dim x As Single
Selection.ExtendMode = False
Selection.EndKey unit:=wdLine
x = Selection.Information(wdHorizontalPositionRelativeToTextBoundary)
MsgBox x
End Sub

See help on information,
then proceed to
Type Required WdInformation. The information type.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Re: Determining length of line by Helmut

Helmut
Sat Sep 08 04:26:18 CDT 2007

Hi Jonathan,

just occurred to me:

Beware of paragraphs with left indentation. :-)

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"