Discussion Locked

Writing a macro or code in Word

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'd like to know if someone can tell me how to write some sort of macro or code to replace strings of characters in Word. Here's what I'm trying to deal with: A list of MP3 files which looks like this:

Track 17: Length: 03:57.69, Pause frames: 150, Filters: 0, Name: 'OBWAT - I'll fly away.mp3'.
Track 18: Length: 04:19.61, Pause frames: 150, Filters: 0, Name: 'David Lindley - Pay Bo Diddley.mp3'.
Track 19: Length: 02:09.07, Pause frames: 150, Filters: 0, Name: 'David Lindley (BrowneAlb.)-Fiddlin' Around 1975.mp3'.

I want to replace everything from "Length" through "Name:" Obviously, global search and replace won't work because the Length numbers change for each song. So...is there a way to tell Word to take everything from "Length? through ?Name:" and replace it with a single space?

Thanks for any help,

Win

5 replies

by dklippert

This works for me:

Length*e:

Put a space in front of Length and don't put anything in the replace box.
There's more wildcard info at:
www.mvps.org/word/FAQs/General/UsingWildcards.htm

by winmorgan

Wel...I was hoping that would do it, but it doesn't work for me. I'm using Word 2000 in Microsoft Office.

I tried it just as you said, with a space in front of "length" and then *e: (so, I put _length*e (where the underscore is a space) in the find box and nothing at all in the replace box and I click Replace All and get a message that 0 replacements were made.

To be on the safe side, I then copied your text just as you gave it and pasted it into the Find box, with nothing in the Replacebox...unfortunately, same result: "0 replacements made." Any other suggestions??

Thanks,

Win

by dklippert

Make sure that "Use Wildcards" is checked under Search Options. (If you don't see it, click on the "More" button.)
You could make the Find look more fancy by using

( Length:) (*) (Name:)
once again using Wildcards.

by winmorgan

DUDE!!!...as they say.

Worked like a charm. Thanks for the clarification. Once Use Wildcards was checked, it worked like a charm.

Best regards and many thanks,

Win

This discussion is closed to new replies.