Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
RPMitchal RPMitchal is offline
external usenet poster
 
Posts: 135
Default Looping Macro for Selection String Between Quotation Marks

Word 2003

I have attempted to put together the below looping macro which essentially
searches for a word or words surrounded by quotation marks in Document (2),

selects everything between and including the opening and closing quotation
marks by using the "Extend" feature (F8);

copies the selected string and pastes it at the cursor position in Document
(1);

inserts a paragraph return; and

then switches back to Document (2), advances past the highlighted selection
and repeats the same functions until reaching the end of the document.

The macro seems to work just fine until such time as I insert the "Do While"
and the "Loop" commands in an attempt to get the macro to repeat itself until
reaching the end of the document.

Obviously, I am missing at the very least €“ one step - and would very much
appreciate any assistance or insight into what I am doing incorrectly. If
the below macro is completely off the mark, I would appreciate being
furnished with the coding for a macro that actually would work and how me the
errors of my ways.

Thanks €“ Rod

Sub Definition()
'
' Definition Macro
' Macro recorded 7/31/2008 by Rod
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = """"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = """"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
Selection.Copy
Windows(1).Activate
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeParagraph
Windows(2).Activate
Selection.MoveRight Unit:=wdWord, Count:=1
Loop

End Sub

 
Thread Tools
Display Modes

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quotation marks JulieMae Microsoft Word Help 10 September 18th 13 02:29 PM
My question marks, apostrophies and quotation marks are weird. pj Microsoft Word Help 1 January 10th 08 09:26 AM
adding quotation marks around a selection (can you help me tweak this code?) Tom Mailmerge 6 December 29th 06 01:24 PM
Why don't my quotation marks appear until I hit another key? Matter of Fact Microsoft Word Help 1 November 17th 05 05:51 PM
quotation marks Michael Microsoft Word Help 3 November 17th 05 02:26 AM


All times are GMT +1. The time now is 06:37 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"