Replace text hàng loạt

  • Khi mà tạo danh sách từ trong excel phục vụ việc dịch tự động
    • Nên đặt các từ dài lên trước, để nó thay thế trước, rồi đổi các từ ngắn sau.
    • Bật tô màu để dễ kiểm soát lại.

Bản gốc tiếng anh

Nguồn: link 

The purpose of this Microsoft Word Help & Microsoft Word Tips page is to provide “VBA Find and Replace©,” a Word template add-in for Word2003\2007\2010, to the Word user community.

VBA Find and Replace© provides a method for finding and replacing text anywhere in a document (or collection of documents) using single user defined “find” and “replace” variable pairs, or a user defined list of “find” and “replace” pairs. It also provides a method to find text and replace found text with a user defined “AutoText” or “Building Block” entry.

The add-in has been around for a while and over the years I have made several “quick” changes and modifications to support suggestions from its many users and fans. It had become rather complex and a bit unwieldy as a result and so with this release I decided to give it a face lit and completely overhaul the code. The goal of course was to make the add-in easier to use. I think I have done that, but you the user are the final judge.

There are two versions of the add-in. Numbered the same, the versions are nearly identical with the exception of the user controls used to initiate the add-in. The .dot version works in Word2003\2007\2010. The .dotm version is intended for Word2007\2010 users. The user interface (UI) controls and their locations are shown below.

Site Note icon Note: Prior to this update I have not used version numbering with this add-in. To avoid confusing current users I have started version numbering beginning with 2.0.

Menu command
.dot version adds a Word 2003 Menu Command

Ribbon command
.dot and .dotm version adds a Word 2007/2010 Ribbon Add-Ins tab control

FR group command
.dotm versios add a Word 2007/2010 Ribbon Home tab>Editing group control

Executing either of the UI controls displays the add-in user interface. As you should see from the illustration, features are disabled until qualified. For example, you can’t “EXECUTE” or define a “Find what/Replace with” variable pair until a “Search using” option is selected.

VBA FR UI Panel

Site Note iconNote: Since this add-in was initially intended for performing multiple find and replace operations using a defined list, “Find whole words only” is true by default.

Selecting “a single word/phrase” as the search option qualifies and enables appropriate controls for user input. Notice that you still can’t “EXECUTE” because you have not defined a valid “Find what” variable.

VBSA FR UI Panel

Defining a “Find what” term qualifies the remaining controls thus allowing the user to execute the operation.

VBA FR UI Panel 2

Site Note iconNote: Just like with the built-in replace utility, leaving the “Replace with” field empty deletes (replaces with nothing) any found text when the process is executed. Perhaps you will find it annoying, but I have added a confirmation requirement is this case.

VBA FR UI Panel 3

When the “a single word/phrase” option is selected and with a “Find what” field entry defined, the “AutoText Entry (as replacement) option becomes available. This powerful feature lets you select a defined AutoText\Building Block entry to use as the “Replace with” variable.

VBA FR UI Panel

After executing “SELECT AUTOTEXT,” the user selects and inserts a predefined AutoText\Building Block entry from the displayed dialog. This process automatically copies the selected AutoText\Building Block entry to the system clipboard and the add-in uses the clipboard content as the “Replace with” variable

Site Note iconNote: The “AutotText Entry (as replacement) option is available only with the “a single word/phrase” search option.

The remaining “Search using” options use one of three user defined lists containing “Find” and “Replace” pairs to perform repetitive replace operations on a single document of collection of documents in a selected batch folder. As sample “QuickList” is shown below.

The add-in provides feedback to the user as operation are executed/completed.

An execution log is available when the “Process Files in Batch Folder” option is used.

The “Info/Tips” command button provides information and tips for using the add-in.

Download the templates here: VBA Find and Replace.

Site Note icon For more on template add-ins and how to load them, see: Organizing Your Macros/Template Add-ins at: Installing Macros

That’s it! I hope you have found this tips page useful and informative.

Để lại một bình luận