J
Jonathan Sachs
I have code to find each instance of italic text in a range. It looks
something like this:
Dim r as range, f as font
set r = selection.range
set f = New Font
f.italic = True
With r.Find
.text = ""
.Forward = True
.Wrap = wdFindAsk
.Font = f
.format = True
Do
.Execute Wrap:=wdFindStop
If Not .found Then Exit Do
' (Do some stuff to the italic text)
Loop
End With
This works in Word 2000. In Word XP it doesn't. The ".Execute"
statement never finds anything.
I tried performing the operation manually. That worked. I tried
performing the operation manually and recording a macro so that I
could imitate the recorded code. The recorded code didn't refer to the
font at all -- just as if I hadn't set it!
Can anyone tell me how to perform this operation?
My mail address is jsachs177 at earthlink dot net.
something like this:
Dim r as range, f as font
set r = selection.range
set f = New Font
f.italic = True
With r.Find
.text = ""
.Forward = True
.Wrap = wdFindAsk
.Font = f
.format = True
Do
.Execute Wrap:=wdFindStop
If Not .found Then Exit Do
' (Do some stuff to the italic text)
Loop
End With
This works in Word 2000. In Word XP it doesn't. The ".Execute"
statement never finds anything.
I tried performing the operation manually. That worked. I tried
performing the operation manually and recording a macro so that I
could imitate the recorded code. The recorded code didn't refer to the
font at all -- just as if I hadn't set it!
Can anyone tell me how to perform this operation?
My mail address is jsachs177 at earthlink dot net.