Private Sub Command1_Click()
Set docApp = CreateObject("Word.Application")
docApp.Visible = TrueSet doc1 = docApp.Documents.Open("C:\a\b\c.doc")docApp.Selection.Find.ClearFormatting
With docApp.Selection.Find
.Text = "国家"
.Replacement.Text = "中国"
.Forward = True
.Wrap = 1
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = True
End With
docApp.Selection.Find.Execute
docApp.Selection.TypeText "中国"
doc1.Close
Set doc1 = Nothing
docApp.Quit
Set docApp = NothingEnd Sub数据读到c.doc后怎样能另存为一个ok.doc并保存在C:\a\b\ 下。
Set docApp = CreateObject("Word.Application")
docApp.Visible = TrueSet doc1 = docApp.Documents.Open("C:\a\b\c.doc")docApp.Selection.Find.ClearFormatting
With docApp.Selection.Find
.Text = "国家"
.Replacement.Text = "中国"
.Forward = True
.Wrap = 1
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = True
End With
docApp.Selection.Find.Execute
docApp.Selection.TypeText "中国"
doc1.Close
Set doc1 = Nothing
docApp.Quit
Set docApp = NothingEnd Sub数据读到c.doc后怎样能另存为一个ok.doc并保存在C:\a\b\ 下。
doc1.SaveAs "C:\a\b\.ok.doc"
doc1.SaveAs "C:\a\b\.ok.doc"doc1.Close
Set doc1 = Nothing
docApp.Quit
Set docApp = NothingEnd Sub
c.doc里的国家有二个或二个以上的话怎才能把中国二个字全部替换例如:
c.doc里有
世界上人口最多的是国家。
世界上最大的发展中-国家世界上人口最多的是中国。
世界上最大的发展中-中国我会马上再加20分.
docApp.Selection.WholeStory
docApp.Selection.Find.ClearFormattingdocApp.Selection.Find.ClearFormatting
With docApp.Selection.Find
.Text = "国家"
.Replacement.Text = "中国"
......
docApp.Selection.Find.ClearFormatting
docApp.Selection.Find.Replacement.ClearFormatting
With docApp.Selection.Find
.Text = "国家"
.Replacement.Text = "中国"
......