Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm working on a long technical document that contains numerous displays of computer code. In running text, I want my quotation marks to be curly, which means that Word's "smart quotes" autoformatting-as-I-type feature is one I want on. But in code displays, curly quotes are incorrect, so in these cases, I want smart-quotes-as-I-type disabled. Is there a fast way to toggle this setting? Or is there a way I can tie it to the paragraph style I'm in? (I use a distinct style for code displays.)

Currently, to toggle the setting, I have to click File>Options>Proofing>AutoCorrect Options...>"Straight quotes" with "smart quotes">OK>OK, which is seven mouse clicks. Toggling it back is another seven mouse clicks. Isn't there a faster way? A keyhboard shortcut to do the toggling or a toolbar button that would toggle it with a single click would be great. Having the setting depend on the paragraph style I was in would be even better.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

OK, here's the answer:

  1. Go to View tab > Macros > Record Macro
  2. Give the macro a name and assign it to a key / shortcut (key combination)
  3. Record something (does not matter what, we will reset it in a moment). Click on Macros > Stop Recording to stop.
  4. Repeat steps 1-3 in order to create another macro (so we have now 2 macros total).
  5. Go to View tab > Macros > View Macros
  6. Choose the first macro and click Edit
  7. Delete all the lines inside the macro's code (it's Visual Basic) except the sub Macro_Name() and End Sub
  8. Copy this line into the sub: Options.AutoFormatReplaceQuotes = True
  9. Do the same to the other macro, but write Options.AutoFormatReplaceQuotes = False instead.

Ultimately, that's the code (you may have other names and/or descriptions for your macros): Also note that in Visual Basic, ' defines a comment line (usually it turns the line green), means that line will not be executed.

 Sub ToggleQuotes1()
'
' ToggleQuotes1 Macro
' Smart Quotes
'
    Options.AutoFormatReplaceQuotes = True
End Sub
Sub ToggleQuotes2()
'
' ToggleQuotes2 Macro
' Regular quotes 
'
    Options.AutoFormatReplaceQuotes = False
End Sub

P.S - There are two smart qoutes options under proofing. One is under the AutoFormat tab and the other is AutoFormat as you type. Here I've changes the first one, but the second one goes like that: Options.AutoFormatAsYouTypeReplaceQuotes = True Options.AutoFormatAsYouTypeReplaceQuotes = False

share|improve this answer
    
Awesome, thank you so much! I'm going to mark this as the answer, but before I do, I'm hoping you'll tell me how I can add these macros to my toolbar... (A link to how to do it would be fine.) –  KnowItAllWannabe Jul 2 '13 at 4:59
2  
I think that will do - just choose Macros under Choose commands from –  matan129 Jul 2 '13 at 5:01

You can do that with only one macro containing the line

Options.AutoFormatAsYouTypeReplaceQuotes = Not Options.AutoFormatAsYouTypeReplaceQuotes

share|improve this answer
    
Cool enchantment! Better then my original solution. –  matan129 Jul 3 '13 at 6:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.