Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

Deleting the second instance of a word in a repeating sequence

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nexan - 19 Apr 2005 17:32 GMT
I'm trying to figure out how to create a macro that will eliminate the second
instance of a word in a repeating list of words. It looks something like this:

CITY: (variable text)
STATE: (variable text)
PHONE: (variable text)
TIME TO CALL: (variable text)
REASON: (variable text)
STATE: (variable text)
Q11B TEXT: (variable text)

CITY: (variable text)
STATE: (variable text)
PHONE: (variable text)
TIME TO CALL: (variable text)
REASON: (variable text)
STATE: (variable text)
Q11B TEXT: (variable text)

How can I create a macro to eliminate only the second instance of "STATE:
(variable text)"?
Greg Maxey - 19 Apr 2005 18:14 GMT
Nexan,

You don't need a macro.  You can use Find and Replace with wildcards.

Find:  (REASON:*^l)(STATE:*^l)(Q11B TEXT:*^l)
Replace with:  \1\3

Note if your lines are broken  with paragraphs vice linebreaks then use ^13
instead of ^l
Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> I'm trying to figure out how to create a macro that will eliminate
> the second instance of a word in a repeating list of words. It looks
[quoted text clipped - 18 lines]
> How can I create a macro to eliminate only the second instance of
> "STATE: (variable text)"?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.