![]() |
#1
|
|||
|
|||
![]()
Hi,
I have a set of documents (word 97 - I can't afford the 'new' office versions) that will build into a novel. Since there is a lot of dialogue, I would like to replace the existing straight sets of double quotes with curly 'smart' double quotes. The 'replace as you type' formatting won't work, since the text has already been typed. Surely there must be a macro to do the following: 1) User selects text (which includes the opening and closing quotes) 2) Running the macro replaces the 'straight' pairs of quotes with 'curly' quotes. 3) It would also be good to have the user select text and then run a macro to surround it with curly quotes! - but this is a separate thing, so no need to bust a gut about it... |
#2
|
||||
|
||||
![]()
You don't need a macro for that - a simple Find Replace for " will apply smart quotes throughout the document (or on just a selected range).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
![]()
You can certainly do this with the replace function as Paul says - i.e. straight quotes to smart quotes (don't forget to set the format as you type option to set smart quotes or the replacement won't achieve anything), but if you might want to change it back again you will need a macro. You will find some basic code at:
http://www.gmayor.com/word_vba_examples_4.htm
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#4
|
|||
|
|||
![]()
No joy - tried this and the quotes remained as straight as ever! I don't want things replaced "as I type" - the text has already been typed, with straight quote marks. It's these that need to be replaced. But I will take a look at the link to the macros, ta.
|
#5
|
||||
|
||||
![]()
You DO want what the autoformat as you type option set while you run the search and replace. That's what causes the replacement to 'retype' the quotes for them to be converted to smart quotes. You can turn off the option afterwards.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#6
|
|||
|
|||
![]()
Hi Graham,
Nope... put some straight quotes around a bit of text, made sure that the 'autoformat as you type' option for smart quotes was on, did the find and replace, and still have straight quotes! Actually, I think I may have tried this in the past with the same result, which is why I was trying to come up with a macro. |
#7
|
||||
|
||||
![]()
Go to File|Options|Proofing>AutoCorrect Options>AutoFormat As You Type and make sure the "Straight Quotes" with “Smart Quotes” option is checked. Also, if you're doing the Find/Replace manually, your Replacement expression needs to be ", not ^&. A macro to do the replacement would work most efficiently by using the same process.
If it still doesn't work, perhaps the issue is related to your Windows Regional Settings. If they're configured for other than an English-language region, the " may not be recognised as a quote character for your region.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
![]()
Nobody has mentioned ^& so I'm not sure what that is! I just felt sure there had to be a way to write a macro which would find in a piece of selected text first of all the ascii for 'opening straight quote', replace it with an 'opening curly quote' then do the same for the parallel closing quotes. As the saying goes, it shouldn't be rocket science (and I do rocket science! - well, astronomy anyway) hence the name.
While on the subject of names, I love yours... macropods = kangaroos, yes? |
#9
|
||||
|
||||
![]()
As I said, a macro would do basically the same as what you've been advised to do manually:
Code:
Sub Demo() Dim bSmtQt As Boolean bSmtQt = Options.AutoFormatAsYouTypeReplaceQuotes Options.AutoFormatAsYouTypeReplaceQuotes = True With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Text = """" .Replacement.Text = """" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With Options.AutoFormatAsYouTypeReplaceQuotes = bSmtQt End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
![]()
Okay, partial success...
if I turn off smart quotes and type some text so that we get straight quotes, then run the macro, we do indeed end up with curlies. However, if there is existing text, running the macro leaves us with straight quotes, irrespective of whether the option is turned off or on (I tried it with both, and the result was the same; no curly quotes). Ho hum... |
#11
|
||||
|
||||
![]()
Can you attach a document to a post with some of the quote characters that don't convert (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find text in between two characters and then format selected text? | qcom | Word | 5 | 02-19-2015 11:23 PM |
Replace curly ("66") quotes | JeremyH | Word | 4 | 11-07-2013 05:43 AM |
curly quotes after em-dash or hard space | btorrance | Word | 0 | 06-07-2013 07:39 AM |
Balky Curly Quotes | JamesT | Word | 0 | 01-23-2010 05:36 PM |
format cells to automatically place quotes around text | dirtleg | Excel | 1 | 09-16-2008 01:52 PM |