PDA

View Full Version : Using Find to



MWE
04-24-2006, 04:45 PM
I am using Find to find specific text in the current Selection and then "operate" on that text. In particular, I want to change the text font to dark red and HighLight the text area with Yellow. The relevant code is:
With Selection.Range.Find
.Text = TargetText
With .Replacement
.Font.Color = wdColorDarkRed
.ParagraphFormat.Shading.BackgroundPatternColor = wdColorYellow
End With
.Execute Format:=True, Forward:=True, Replace:=wdReplaceAll
End With
Using the object browser to explore the properties of Replacement, it seemed that the above should work. I get no error and the font color is correctly changed; but the "background" is not changed. So I am doing something wrong.

Any help would be appreciated.

TonyJollans
04-24-2006, 05:21 PM
The Object Browser is leading you up the garden path on this one.

I don't know where, or even if, this may be documented but you can't format shading on a replacement. Take a look at the Dialog in Word and you will see that you don't have the option to set shading.

Although the ParagraphFormat object used by Replacement is the same as a standard ParagraphFormat object, some of its properties are ignored.

forkus2000
08-29-2006, 02:07 PM
Tony i have a question for you:
How i call the find dialog and goto page dialog ?

I am using a visual basic program to call

Please respond Asap

mdmackillop
08-30-2006, 12:10 AM
Hi Forkus,
If you have a question, please post it in the Word Forum as a new question. In this case, I think you need to be a bit more specific regarding what you want to achieve.
Regards
MD

TonyJollans
08-30-2006, 02:49 AM
I'll second that.

When you start a new thread please say, at least, whether you want to invoke the dialogs (for user interaction) or whether you want the equivalent functionality in code.