2012年5月25日 星期五
vbnet Word.Application
Dim appWord As New Word.Application
Dim docWord As New Word.Document
docWord = appWord.Documents.Open(“C:\Infofarm\test.doc”)
Try
Dim myStoryRange As Microsoft.Office.Interop.Word.Range
For Each myStoryRange In docWord.StoryRanges
With myStoryRange.Find
.Text = “<-email->”
.Replacement.Text = “aaa@oooo.com”
.Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue
.Execute(Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll)
End With
Next myStoryRange
docWord.Save()
appWord.Quit()
docWord = Nothing
appWord = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言