zoukankan      html  css  js  c++  java
  • VB 替换word文档中页眉页脚的文字

    查找资料,替换成功的只有替换页面内容的文字

    Sub docs()Dim wordapp
      Set wordapp = CreateObject("Word.Application")
        With wordapp
            .documents.Open (ThisWorkbook.Path & "test.docx")
            .Visible = True
            .activedocument.content.Find.Execute FindText:=text1, ReplaceWith:=text2, Replace:=2
            .documents.Close
        End With
      wordapp.Quit
      Set wordapp = Nothing
    End Sub

    加上写C#用过DOM API 测试成功

    Sub docs()
    Dim wordapp
      Set wordapp = CreateObject("Word.Application")
        With wordapp
            .documents.Open (ThisWorkbook.Path & "test.docx")
            .Visible = True
            .ActiveWindow.ActivePane.View.SeekView = 9
            .Selection.Find.Execute FindText:=text1, ReplaceWith:=text2, Replace:=2
            .ActiveWindow.ActivePane.View.SeekView = 0
            .documents.Close
        End With
      wordapp.Quit
      Set wordapp = Nothing
    End Sub  
  • 相关阅读:
    架构设计-业务逻辑层简述
    大牛的法宝
    架构设计中服务层的简单理解
    架构师都要懂哪些知识
    python 面向对象
    Ubuntu学习
    装饰器
    Py之基础数据类型
    Py之模块
    浏览器环境变量
  • 原文地址:https://www.cnblogs.com/rn-05181226-rw/p/11721252.html
Copyright © 2011-2022 走看看