0
我願做一個全部採用VBnet 2003年和2007年的MSWordVBnet MSWORD自動化「替換文本」
我得到這個
Dim Selection As Word.Selection
Selection.Find.ClearFormatting()
Selection.Find.Replacement.ClearFormatting()
Selection.Find.Replacement.Font.Underline = Word.WdUnderline.wdUnderlineSingle
With Selection.Find
.Text = "Text"
.Replacement.Text = "Replacement"
.Forward = True
.Format = True
.Wrap = Word.WdFindWrap.wdFindContinue
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute(Replace:=Word.WdReplace.wdReplaceAll)
它崩潰,並選擇聲稱「每行取代你調用的對象是空的。」我通過執行宏記錄獲得了代碼,並且它可以很好地工作,但我不想在我的文檔中使用宏。我該如何解決?
所有我需要的是昏暗的選擇作爲Word.Selection = Document.ActiveWindow.Selection – 2011-12-23 04:31:36
工作就像一個魅力!非常感謝!! – 2011-12-23 04:31:47