Using straight, not curly, quotes automatically in a single docume


M

Ms D.

Is there any way I can turn off the 'AutoFormat as you Type' options for a
single document, not for all Word documents?

I work on a lot of documents in a day, and 90% need to have typographer's
quotes. 10%, however, are used to create code, so need to have straight
quotes.

Ideally, I would like to be able to turn off the 'AutoFormat as You Type'
options specifically for the 10% of documents, without this affecting the
remaining 90% of my documents. If possible, I want to avoid having to
remember to set the AutoFormat options every time I open a document. (I also
want to avoid using a macro if possible, as the code in the 10% is extracted
to a .txt file using a macro.)

I'm aware that I can turn off AutoFormat options for *all* Word documents,
or press CTRL+Z when typing, or do a Find and Replace when I'm done, etc...
 
Ad

Advertisements

G

Graham Mayor

If you are extracting the text of the 10% of documents to a text file using
a macro, then the obvious solution would be to add the code to your macro to
convert the smart quotes to straight quotes before saving as TXT. The
original document need not be changed, nor would you need to change your
default quotes preference

A code for swapping the quotes would be

Dim vFindText As Variant
Dim vReplText As Variant
Dim sFormat As Boolean
Dim i As Long
sFormat = Options.AutoFormatAsYouTypeReplaceQuotes
vFindText = Array(Chr(147), Chr(148), Chr(145), Chr(146))
vReplText = Array(Chr(34), Chr(34), Chr(39), Chr(39))
Options.AutoFormatAsYouTypeReplaceQuotes = False
Selection.HomeKey wdStory
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
Options.AutoFormatAsYouTypeReplaceQuotes = sFormat

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Ad

Advertisements

M

Ms D.

Thanks, that's great :)

Graham Mayor said:
If you are extracting the text of the 10% of documents to a text file using
a macro, then the obvious solution would be to add the code to your macro to
convert the smart quotes to straight quotes before saving as TXT. The
original document need not be changed, nor would you need to change your
default quotes preference

A code for swapping the quotes would be

Dim vFindText As Variant
Dim vReplText As Variant
Dim sFormat As Boolean
Dim i As Long
sFormat = Options.AutoFormatAsYouTypeReplaceQuotes
vFindText = Array(Chr(147), Chr(148), Chr(145), Chr(146))
vReplText = Array(Chr(34), Chr(34), Chr(39), Chr(39))
Options.AutoFormatAsYouTypeReplaceQuotes = False
Selection.HomeKey wdStory
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
Options.AutoFormatAsYouTypeReplaceQuotes = sFormat

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

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






.
 

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