日期:2014-05-17 浏览次数:21136 次
Sub 宏1()
'
' 宏1 宏
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "aa"
.Replacement.Text = "^c"
.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
End Sub
object FindText, Replace, ReplaceWith;
object MissingValue = Type.Missing;
wordDoc.Content.Find.ClearFormatting();
wordDoc.Content.Find.Replacement.ClearFormatting();
FindText = "aa";
ReplaceWith = "^c";
wordDoc.Content.Find.Forward = true;
wordDoc.Content.Find.Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue;
wordDoc.Content.Find.Format = false;
wordDoc.Content.Find.MatchCase = false;
wordDoc.Content.Find.MatchWholeWord = false;
wordDoc.Content.Find.MatchByte = false;
wordDoc.Content.Find.MatchWildcards = false;
wordDoc.Content.Find.MatchSoundsLike = false;
wordDoc.Content.Find.MatchAllWordForms = false;
Replace = Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll;
wordDoc.Content.Find.Execute(ref FindText, ref MissingValue,
ref MissingValue, ref MissingValue,
ref MissingValue, ref MissingValue,