Word文档用代码移除Header

在PIA中Microsoft 似乎没有给出移除Header的方法。在实践中我发现下面代码能做到这一点:

        Dim wdApp As Word.Application
        Dim wdDoc As Word.Document
        Dim wdSection As Word.Section

        wdApp = Globals.ThisDocument.Application
        wdDoc = wdApp.ActiveDocument
        wdSection = wdDoc.Sections(1)
        wdSection.Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Text = String.Empty



欢迎访问《许阳的红泥屋

你可能感兴趣的:(header)