Quotes again-can't replace curly with straight

K

Katy M

Hi,

I'm reviewing a Word 2003 SP1 document, and some of the apostrophes are
curved, some are straight. Worst of all, some of the end quotes are curved
wrong, and there are quite a few in this document (background-the document is
generated from AuthorIT, but I've been told that quote formatting is
determined by Word).

I've tried several approaches, including using the search and replace, but
am not confident I've found them all. The best bet seems to be to make them
all straight. But when I've tried changing them using the auto correct
function, nothing happens (I have unchecked the "replace straight with curly"
box).

Any suggestions would be highly appreciated.
 
G

Graham Mayor

The following macro should replace the smart quotes (and the characters
often confused with quotes) in a document with plain quotes.

Sub ReplaceSmartQuotes()
Dim vFindText As Variant
Dim vReplText As Variant
Dim sQuotes As Boolean
Dim i As Long
Selection.HomeKey wdStory
sQuotes = Options.AutoFormatAsYouTypeReplaceQuotes
Options.AutoFormatAsYouTypeReplaceQuotes = False
vFindText = Array(Chr(180), Chr(96), Chr(145), Chr(146), Chr(147), Chr(148))
vReplText = Array(Chr(39), Chr(39), Chr(39), Chr(39), Chr(34), Chr(34))
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True

For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Execute replace:=wdReplaceAll
Next i
End With
'***************************
'Activate the following lines to reformat with smart quotes
'With Options
' .AutoFormatAsYouTypeReplaceQuotes = True
' .AutoFormatReplaceQuotes = True
'End With
'Selection.Range.AutoFormat
'***************************

Options.AutoFormatAsYouTypeReplaceQuotes = sQuotes
End Sub

http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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