#1
|
|||
|
|||
Make a Macro Run In 'Search and Replace?'
Is it possible, using Word 2007, to place a macro into the 'Search/Replace' tool, so that it will find all possible ocurrences of the specified 'search' item, then replace them with the specified 'replace' item?
I have a long list of items in a receipt that contains a lot of spaces. The spaces make the receipt over 20 pages in length. By removing the spaces, it would shorten the receipt to only one page, which would make it nicer to print, of course. So, for example, I would like to remove the spaces from this: 1. Great Value Honey Roasted Peanuts, 16 oz Qty1 $1.98 ($1.98/ea), making it look like this: 1. Great Value Honey Roasted Peanuts, 16 oz Qty1 $1.98 ($1.98/ea) Not sure how to do that, so any help would be greatly appreciated. (The actual receipt has far more spaces than what I have shown) |
#2
|
||||
|
||||
It's not apparent that you need anything other than a wildcard Find/Replace for this but, without seeing a document containing some representative content, it's impossible to know for sure. You can attach a document to a post via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Macropod,
Thanks for your help. I've never used the wildcard function before, so maybe you could coach me on that? I'd really appreciate it. Thanks again! |
#4
|
||||
|
||||
Most of this can be done by:
Find: ^13(Qty[0-9]{1,})^13 Replace With: " \1 " without the quotes but with spaces either side of the \1 You can add Format>Paragraph>Alignment=Left to the Replace With box to make sure the result aligns left. A separate find replace can be used to bring the return($ onto the same line. For that one you can: Find: ^13(\($) Replace with: " \1"
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
Thanks 'Guessed,' I will give that a try. I've never used the wildcard stuff, before, so I don't know what each of them stand for.
I really appreciate your help. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to search names/ids and replace text in another column | Kalü | Excel Programming | 1 | 12-06-2018 07:14 PM |
Adding terms to a search & replace macro | Ulodesk | Word VBA | 6 | 03-29-2018 05:30 AM |
Macro on Search and Replace | davidhuy | Word VBA | 1 | 12-19-2014 04:47 AM |
Macro to search warning text style and replace the text color | rohanrohith | Word VBA | 3 | 11-27-2014 01:08 PM |
Search and Replace - Clear Search box | JostClan | Word | 1 | 05-04-2010 08:46 PM |