Belch
09-03-2007, 08:01 AM
Hi all,
I have some text which is input to a String variable. This String is then output to a cell in a table. This is repeated many times, being added to a new row in the table each time.
Some text needs to be made bold - sometimes a single word, sometimes a sentence. Each word that needs to be made bold has a "%%" before it - this is the only way I could think to mark which words to make bold. So for example a word would appear as "%%hello".
At the moment I have the following code:
With Selection
.Find.ClearFormatting
.Find.Text = "%%"
Do While .Find.Execute(Forward:=True, Wrap:=wdFindContinue) = True
.Expand (wdWord)
.Font.Bold = True
Loop
End With
This finds the %% text ok, and makes the %% bold, but as you can see I'm trying to expand the selection to the word attached to the %% before setting bold to true. However it isn't expanding the selection.
Any ideas? Thanks in advance,
I have some text which is input to a String variable. This String is then output to a cell in a table. This is repeated many times, being added to a new row in the table each time.
Some text needs to be made bold - sometimes a single word, sometimes a sentence. Each word that needs to be made bold has a "%%" before it - this is the only way I could think to mark which words to make bold. So for example a word would appear as "%%hello".
At the moment I have the following code:
With Selection
.Find.ClearFormatting
.Find.Text = "%%"
Do While .Find.Execute(Forward:=True, Wrap:=wdFindContinue) = True
.Expand (wdWord)
.Font.Bold = True
Loop
End With
This finds the %% text ok, and makes the %% bold, but as you can see I'm trying to expand the selection to the word attached to the %% before setting bold to true. However it isn't expanding the selection.
Any ideas? Thanks in advance,