Auto Formatting Imported Text

P

Plentyodough

I am importing data from notepad into Word 2007. There are several hundred
data sets. Each data set contains 10 lines. Each data set needs to have the
same font style applied to it however this font is different from others
being used elsewhere in the document. The first word in each line needs to
be bold. How can this be automated?
 
G

Graham Mayor

You haven't said how you are importing the text, however the following macro
will format 10 lines of selected text with the font Times New Roman and
apply the bold attribute to the first word on each line

With Selection
.Font.Name = "Times New Roman"
.Words(1).Font.Bold = True
.Collapse
For i = 1 To 9
.MoveDown wdLine, 1
.Words(1).Font.Bold = True
Next i
End With

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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