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 2006

Tip: Looking for answers? Try searching our database.

Newbie Macro Question: Deleting all words on a line except a special string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GoCoogs - 06 Apr 2006 18:02 GMT
Hello. First off I want to apologize because I already posted in
microsoft.public.word.word97vba   but upon further research, I think
this is the better newsgroup for this issue.

I'm really learning macros to work with this current project. I
have tons of logs with lines looking like:

unknown (serv-2-4-73.lycos-vds.com ): 15 Time(s)

All I want from lines like these are

(serv-2-4-73.lycos-vds.com ): 15

I'm sure its very easy, but how would I delete all text (including
white space at the beginning of a line) before the first "(" and
"Time(s)" for a line? I'm sure a simple macro can do the job.

Thanks in advance,

Blake

btw, I've spent a good chunk of time researching this and feel rather
stupid for not finding a solution yet.
Tony Jollans - 06 Apr 2006 18:27 GMT
You can use a macro if you like - just record yourself doing this.

Ctrl+H to get the Find and Replace dialog
Find: *([\(][!\)]@[\)]: [0-9]@) *^13
Replace: \1^p
Check Use Wildcards
Hit Replace all

This assumes your lines end in paragraph marks - if they end in manual line
breaks change ^13 in the find string with ^l (caret, lowercase-L) and ^p in
the replace string also to ^l

--
Enjoy,
Tony

> Hello. First off I want to apologize because I already posted in
> microsoft.public.word.word97vba   but upon further research, I think
[quoted text clipped - 19 lines]
> btw, I've spent a good chunk of time researching this and feel rather
> stupid for not finding a solution yet.
 
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.