Excel & Word - 머리글&바닥글 삭제

반응형
반응형

머리글&바닥글 삭제

Sub KillHeaderAndFooter()

Dim objHF As HeaderFooter

Dim objSection As Section

For Each objSection In ActiveDocument.Sections

For Each objHF In objSection.Headers

objHF.Range.Delete

Next objHF

For Each objHF In objSection.Footers

objHF.Range.Delete

Next objHF

Next objSection

End Sub

------------

응용해서 바닥글만 삭제 한다면

Sub KillFooter()
    Dim objHF                   As HeaderFooter
    Dim objSection              As Section
    For Each objSection In ActiveDocument.Sections
        For Each objHF In objSection.Footers
            objHF.Range.Delete
        Next objHF
    Next objSection
End Sub

요렇게 하면 되겠습니다.

반응형

이 글을 공유하기

댓글

Designed by CMSFactory.NET