Find and replace in Word (2002) Macros.

B

Brian Keable

Ihave recorded a macro :
Sub Macro6()
'
' Macro6 Macro
' Macro recorded 04/02/2006 by Keable
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^0180"
.Replacement.Text = "^0170"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Purpose of macro is to replace the acute accent character Code 0180 with a
Spade symbol (character code 0170) from the Symbol font. When I record the
macro - it works , but not when run the macro.
In the manual process I tell Replace that I wish to format and use the
Symbol font.
However as you can see there is nothing in the macro to indicate which font
to use
How can I fix? I have many docs from an friends old Mac that need converting
in this way
 
J

Jay Freedman

Hi Brian,

The recorder is broken with respect to all formatting in Find/Replace.
The section "Fixing broken Replace macros" in
http://www.word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm
discusses this. If you rely on the recorder, you have to manually add
the line

.Replacement.Font = "Symbol"

somewhere within the With Selection.Find...End With area.

A better macro (not something you could record) can be found at
http://www.word.mvps.org/FAQs/MacrosVBA/FindReplaceSymbols.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 4 Feb 2006 10:15:45 -0800, Brian Keable <Brian
 

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