Home > OS >  A few days before the word replacement problem solved, with macro code and methods, and new problems
A few days before the word replacement problem solved, with macro code and methods, and new problems

Time:10-14

Antecedents feed
http://bbs.csdn.net/topics/391985595
Are going to make a COM, later found VBA seems to satisfy my needs, it took a few days time to fill out a EXCEL list the need to replace the document
Use the previous code
Sub on table to replace ()
'the first quotes ms excel
'before running close all excel program
Dim the ex As Excel Application, boo As Excel. The Workbook, shee As Worksheet, I As an Integer
Set the ex=New Excel. Application
The Set boo=ex. Workbooks. Open (" E: \ replacement tables. XLS ")
Ex. The Visible=False 'set the EXCEL object Visible or invisible
The Set shee=boo. Worksheets (1)
'Set the activity scheduleWith shee
For I=1 To.. Range (" b65536 "). The End (xlUp). Row
ActiveDocument. Content. The Find. The Execute findtext:=. The Range (" a "& amp; I), replacewith:=Range (" b "& amp; I), Replace:=wdReplaceAll, Forward: B=True 'will Replace excelA column for column content
Next
End With
Boo. Close
Ex. The Quit
The Set boo=Nothing
Set the ex=Nothing
End Sub

Run time attention in Basic "tool" -- reference check the Excel Object library, or macro couldn't run
In general is done, the subsequent also some conflicts need to debug slowly, such as some of the words including other words
Banana=bananas, for example, the translation will bring up an individual when translated into "a", becomes "b one by one," I don't know how to solve, how about the need to add a judgment of code?

CodePudding user response:

This problem has solved the...
Just change the parameters
MatchWholeWord=True
  • Related