#1   Report Post  
Ziaforever
 
Posts: n/a
Default Adding quotation marks

I want to be able to highlight a sentence, click a button or, better yet,
right-click, and the sentence is in quotation marks. I have hundreds of
quotes in my document and I don't want to have to add marks at the beginning
and end of each and every one.
  #2   Report Post  
Klaus Linke
 
Posts: n/a
Default

Hi,

You can put the macro below on a toolbar button, or keyboard shortcut, or
context menu:

Dim myRange As Range
Set myRange = Selection.Range.Duplicate
' So you don't need to eliminate the ΒΆ mark from the selection:
If myRange.Characters.Last.Text = vbCr Then
myRange.MoveEnd Unit:=wdCharacter, Count:=-1
End If
myRange.InsertAfter ChrW(&H201D)
' So the quote matches the formatting of the first character:
myRange.Characters(1).Text = ChrW(&H201C) _
& myRange.Characters(1).Text
' Restore the selection to what it was:
myRange.Select

For help with macros, see
http://www.word.mvps.org/FAQs/Macros...eateAMacro.htm and the links in
that article.

If the paragraphs that should get quotation marks have anything that
distinguishes them from other paragraphs (tab, indent...), you can also put
all the quotes in with one Find/Replace.

Say, if they are all in the "Dialogue" style:
Check "Match wildcards" in "Edit Replace",
Choose the "Dialogue" style in "More Format Style",
Find what: ([!^13]@)(^13)
Replace with: "\1"\2

Regards,
Klaus


"Ziaforever" wrote:

I want to be able to highlight a sentence, click a button or, better yet,
right-click, and the sentence is in quotation marks. I have hundreds of
quotes in my document and I don't want to have to add marks at the
beginning and end of each and every one.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:19 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"