复制Excel工作表中页眉页脚到其他工作表的方法?( 二 )


ws.PageSetup.HeaderFooter = xlHeaderFooterNone
ws.PageSetup.PrintTitleRows = ""
ws.PageSetup.PrintTitleColumns = ""
ws.PageSetup.PrintArea = ""
ws.PageSetup.PrintComments = xlPrintNoComments
ws.PageSetup.PrintQuality = 600
ws.PageSetup.CenterHorizontally = False
ws.PageSetup.CenterVertically = False
ws.PageSetup.Orientation = xlPortrait
ws.PageSetup.Draft = False
ws.PageSetup.PaperSize = xlPaperA4
ws.PageSetup.FirstPageNumber = xlAutomatic
ws.PageSetup.Order = xlDownThenOver
ws.PageSetup.BlackAndWhite = False
ws.PageSetup.Zoom = False
ws.PageSetup.PrintErrors = xlPrintErrorsDisplayed
ws.PageSetup.PrintTitleRows = ""
ws.PageSetup.PrintTitleColumns = ""
ws.PageSetup.PrintArea = ""
ws.PageSetup.PrintComments = xlPrintNoComments
ws.PageSetup.PrintQuality = 600
ws.PageSetup.CenterHorizontally = False
ws.PageSetup.CenterVertically = False
ws.PageSetup.Orientation = xlPortrait
ws.PageSetup.Draft = False
ws.PageSetup.PaperSize = xlPaperA4
ws.PageSetup.FirstPageNumber = xlAutomatic
ws.PageSetup.Order = xlDownThenOver
ws.PageSetup.BlackAndWhite = False
ws.PageSetup.Zoom = False
ws.PageSetup.PrintErrors = xlPrintErrorsDisplayed
ws.PageSetup.PrintTitleRows = ""
ws.PageSetup.PrintTitleColumns = ""
ws.PageSetup.PrintArea = ""
ws.PageSetup.PrintComments = xlPrintNoComments
ws.PageSetup.PrintQuality = 600
ws.PageSetup.CenterHorizontally = False
ws.PageSetup.CenterVertically = False
ws.PageSetup.Orientation = xlPortrait
ws.PageSetup.Draft = False
ws.PageSetup.PaperSize = xlPaperA4
ws.PageSetup.FirstPageNumber = xlAutomatic
ws.PageSetup.Order = xlDownThenOver
ws.PageSetup.BlackAndWhite = False
ws.PageSetup.Zoom = False
ws.PageSetup.PrintErrors = xlPrintErrorsDisplayed
End If
Next
End Sub
④按下F5键执行宏
四、 注意事项
在复制页眉页脚时需要注意以下几点:
1.不同的工作表可能有不同的打印设置,所以需要把所有的设置都复制过来 。
2.复制页眉页脚时需要把“不同的第一页页眉页脚”和“偶数页页眉页脚”设置为true 。
3.如果需要复制页码,需要把“页脚”中的页码设置为“自动” 。
5. 如果粘贴时出现错误,可以尝试在“页面布局”中重新打开“页眉页脚”,然后关闭 。

猜你喜欢