Formatting text when exporting to MS Word

J

James Frater

Hello All,

I'm exporting results of a table into a table in a Word document.

I can currently change the formatting of the individual word "referee:" but
I'd also like to change the actual name of the referee as well

Example - I'd like the text "Referee:James Frater" to all be size 7,
coloured blue, and bolded.

Any thoughts

JAMES

Set R = WdApp.ActiveDocument.Sections(1).Range
With R.Find
.ClearFormatting
.Text = "Referee: [I'm lost here]
With .Replacement
.ClearFormatting
.Text = ""
.Font.Color = wdColorBlue
.Font.Size = 7
.Font.Bold = True
End With
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
 
C

Crystal (strive4peace)

Hi James,

it would be best to do the formatting when you write the
information ... you can't do this with search/replace alone
unless you know exactly what you are looking for.

Once you find "referee:", then you need to select the name
as well -- is it on a line by itself? If so, you can do
something like this:

'~~~~~~~~~~~~~~~~~~
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Referee:"
.Replacement.Text = "Referee:"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Color = wdColorBlue
Selection.Font.Size = 7
Selection.Font.Bold = True
Selection.EndKey Unit:=wdLine
Selection.MoveRight Unit:=wdCharacter, Count:=1
'~~~~~~~~~~~~~~~~~~


Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
 

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