![]() |
|
#2
|
||||
|
||||
|
Do you have a file containing just the ACCA.101069REG-SIM, ACCA.101070REG-SIM, ACCA.101071REG-SIM, etc. references and their reference text? If so, and if you can organise that into a tab-delimited layout like:
ACCA.101069REG-SIM → Mr. Travel is a U.S. citizen who has been a resident of Germany for five years.¶ ACCA.101070REG-SIM → Mr. Travel is a U.S. citizen who has been a resident of Spain for five years.¶ ACCA.101072REG-SIM → Mr. Travel is a U.S. citizen who has been a resident of Portugal for five years.¶ in a document with just a tab separating the reference from the question, and a paragraph break between entries, the following macro could do it for you: Code:
Sub BulkFindReplace()
Application.ScreenUpdating = False
Dim FRDoc As Document, FRList, j As Long, StrFnd As String, StrRep As String
'Load the strings from the reference doc into a text string to be used as an array.
Set FRDoc = Documents.Open("Drive:\FilePath\FindReplaceList.doc")
FRList = FRDoc.Range.Text
FRDoc.Close False
Set FRDoc = Nothing
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWholeWord = True
.MatchCase = True
'Process each word from the Check List. Tab-delimited strings are assumed, formatted as:
'Find text <Tab> Replace text
For j = 0 To UBound(Split(FRList, vbCr)) - 1
StrFnd = Split(Split(FRList, vbCr)(j), vbTab)(0)
StrRep = Split(Split(FRList, vbCr)(j), vbTab)(1)
.Text = StrFnd
.Replacement.Text = StrFnd & vbCr & StrRep
.Execute Replace:=wdReplaceAll
Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Need Help Creating Macro
|
rsrasc | Word VBA | 4 | 03-28-2014 01:31 PM |
Creating a macro button in powerpoint
|
Sammie0Sue | PowerPoint | 1 | 12-06-2013 05:51 AM |
Creating a generic macro?
|
suerose | Word | 2 | 07-04-2011 07:59 PM |
| Creating a MACRO | Nikb3522 | Word VBA | 0 | 10-21-2010 05:55 PM |
| creating macro | steveb | Word VBA | 0 | 08-14-2010 01:29 AM |