#1
|
|||
|
|||
Find and replace words according to excel file
Hi,
I have a list of words and abbreviations in an excel file, I want to use this list to search and replace words in a word document, and if possible to preserve words formating in the excel file during replacing, eg: Demo: Urinary tract infection (uti) are considered to be the most common and important bacterial infection, elisa test, E. coli most common infectious agent. Excel file with desired formatting words: UTI ELISA E. coli After applying code: Urinary tract infection (UTI) are considered to be the most common and important bacterial infection, ELISA test, E. coli most common infectious agent. Please any help? Thank you |
#2
|
||||
|
||||
Search and replace from an Excel table is relatively straightforward but if you want to include formatting as well it becomes a whole different ballgame.
I would recommend the source table be in Word format so you have more flexible formatting options which don't require special handling. Are you able to set up a Word source for the replacements or does it HAVE to be in Excel?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Quote:
Good idea |
#4
|
|||
|
|||
Quote:
I want to ignore cases during searching, e.g Search for: fimH and fyuA, FimH, FyuA, FIMH, FYUA (the same abbreviations) Replace to: fimH and fyuA See attachment files with my special thanks. |
#5
|
||||
|
||||
See https://www.gmayor.com/document_batch_processes.htm which will process all the document ranges and will include the formatting in the table.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#6
|
|||
|
|||
Quote:
Excuse me Mr. Ghram, can you clarify these points: 1: I want to replace fimH, FimH, and FIMH to fimH, so I used different combination by typing (Y,N,N), (N,Y,N), (Y,Y,N), ...etc but without benefit, so which combination is better for this case? 2: When I left the columns (WC, WWo, OMIT) blanks, it does affect the results? 3: When I type (Y) for a certain column, is necessary to type (N) for other columns? 4: I didn't understand (OMIT) what can do, I want more explanation, please? 5: I added (Process Documents) to QAT, so I want to hide Batch Process tab. Thank you again |
#7
|
||||
|
||||
To replace fimH, FimH, and FIMH with fimH you will need three rows in the table with (or nothing) in the WC column.
It is not necessary to enter N. The process looks for Y. If the OMIT column has Y then that row is not included in the process. The only way to remove the Batch Process tab would be to use the Office Ribbon X editor to remove the add-in's ribbon. I would caution against doing so as it may render the process unusable. If you use it only occasionally, you may find Load Word add-ins for the current session only useful.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#8
|
|||
|
|||
Quote:
Quote:
My problem with this tab is taking large space and you can't rearrange it or add custom commands to this tab, because it hidden by default 04.png Quote:
I made my table without entering (Y or N) to any column, and it produces my desired results, so I think Y or N is not necessary in my case, is right??? see 12.png Thank you |
Tags |
find & replace, vba code, word vba code |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find & Replace Multiple words | Gartholameau | Word VBA | 2 | 01-20-2019 04:56 PM |
multiple find and replace in vba for special words | kvnrao | Word VBA | 7 | 11-02-2018 06:28 PM |
Find and replace mutiple spaces between lowercase words only | Dave T | Word VBA | 2 | 07-16-2015 11:23 PM |
VBA Batch Find & Replace for all MSOffice extensions, to replace File Name and Content of the File | QA_Compliance_Advisor | Word VBA | 11 | 09-11-2014 11:51 PM |
Find & Replace: substitute red-coloured words with underscores | tinfanide | Word | 2 | 10-06-2012 11:04 PM |