码迷,mamicode.com
首页 > 其他好文 > 详细

不打开WORD文档批量替换文档内容

时间:2018-05-27 13:45:35      阅读:462      评论:0      收藏:0      [点我收藏+]

标签:false   cti   open   ocx   cut   word文档   ace   ati   内容   


Sub 批量替换WORD内容()
Dim wd As New Word.Application
pa = ThisWorkbook.Path & "\111.docx"
With wd
.Documents.Open pa
.Visible = False
    For i = 2 To Cells(65535, 1).End(xlUp).Row
    .ActiveDocument.Content.Find.Execute findtext:=Cells(i, 1), replacewith:=Cells(i, 2), Replace:=wdReplaceAll, Forward:=True
    Next
.Documents.Save
.Quit
End With
Set wd = Nothing
End Sub

不打开WORD文档批量替换文档内容

标签:false   cti   open   ocx   cut   word文档   ace   ati   内容   

原文地址:https://www.cnblogs.com/lizicheng/p/9095502.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!