我在pb中操作word,现在要进行替换
我先录制成宏,再改写成pb,
//////////////////宏语句
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "监理单位:"
.Replacement.Text = "监理单位:单位名称"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Windows("未命名 中的文档").Activate
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "监理单位:"
.Replacement.Text = "监理单位:单位名称"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
//////////////////////////////////////////
但是我不知道Selection.Find.Execute Replace:=wdReplaceAll
这句话用应该怎么写
结果在pb中执行,只查找,不替换
string ls_file
ls_file = e:\temp.doc
ole_word.insertfile(ls_file)
ole_word.activate(inplace!)
ole_word.object.application.selection.wholestory()
ole_word.object.Application.selection.find.text = 监理单位:
ole_word.object.Application.selection.find.replacement.text =监理单位:单位名称
ole_word.object.Application.selection.find.forward = TRUE
ole_word.object.application.selection.find.execute()
up
给我发个短消息,告诉我你的Email, 给你发一个VbaWrd.chm 里面有操纵Word的所有的属性、函数, 你在里面找找,肯定能解决