none
VB2010 打算在一个word 文档页眉中找到某字符替换之 RRS feed

  • 问题

  • Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim WDAPP As Object
    WDAPP = CreateObject("Word.Application")
    WDAPP.Documents.Add("C:\ABC.docx")
    WDAPP.Visible = True
    WDAPP.Selection.Find.ClearFormatting()
    WDAPP.Selection.Find.Replacement.ClearFormatting()
    With WDAPP.Selection.Find
    .Text = "ABC"
    .Replacement.Text = "123"
    .Forward = True
    .Wrap = 1
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchByte = True
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = False
    .MatchFuzzy = False
    End With
    WDAPP.Selection.Find.Execute(Replace:=2)
    End Sub

    这一段只能在正文中查找,如何在页眉中,或者页眉页脚都包括呢?


    2015年9月10日 0:30

答案

  • 你好,

    建议你换种方法,VB.NET中是可以这样引用的Word.WdHeaderFooterIndex.wdHeaderFooterPrimary,更多具体的信息和代码可以参考这个文档:https://msdn.microsoft.com/zh-cn/library/ms178795.aspx


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2015年9月11日 3:06