Width of Proportional fonts

P

PathSmart

I have a series of text boxes in a column. Each text box has two words in it. I
want to be able to line up the left letter in each word with the one that
appears in the text box immediatiely above it.
e.g.

Adams, John
Smith, Robert
Jones, Barbara
Brown, Sarah

I do not want the second word to be in a separate colunm, but I want it to look
like that is the case. I know that I can add a tab to try to line things up.
That will line some things up. But not always. Sometimes I need one tab, and
other times I need two. Is there a program or formula in VBA that measures font
width (or looks at the entire word and says "This is 29 pixels wide"?) That way
I could at least 'guesstimate' whether I need one tab or two between the first
name and the last.

Thanks,

Roy
 
J

JGM

Hi Roy,

How about fixing a tab position exactly on the page instead of just blindly
typing one or two and measuring text width, which is complicated?

To get you started, use something like:

'_______________________________________
Selection.HomeKey wdLine
Selection.TypeText Text:="John"

Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(1), _
Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces

Selection.TypeText Text:=vbTab & "Smith"
'_______________________________________

HTH
Cheers
 
W

Word Heretic

G'day (e-mail address removed) (PathSmart),

<chuckles>

Insert text with tabs.

Take range of whole insert and Convert to Table with invis borders :)


(e-mail address removed) (PathSmart) was spinning this yarn:
I have a series of text boxes in a column. Each text box has two words in it. I
want to be able to line up the left letter in each word with the one that
appears in the text box immediatiely above it.
e.g.

Adams, John
Smith, Robert
Jones, Barbara
Brown, Sarah

I do not want the second word to be in a separate colunm, but I want it to look
like that is the case. I know that I can add a tab to try to line things up.
That will line some things up. But not always. Sometimes I need one tab, and
other times I need two. Is there a program or formula in VBA that measures font
width (or looks at the entire word and says "This is 29 pixels wide"?) That way
I could at least 'guesstimate' whether I need one tab or two between the first
name and the last.

Thanks,

Roy

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
wordheretic.com

If my answers r 2 terse, ask again or hassle an MVP,
at least they get recognition for it then.
Lengthy replies offlist require payment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top