0
每次我在某些工作簿上看到代码时,我都会在页面的页脚中找到双重路径。尤其是因为我确实在这里指定中心页脚应该是空的,这实际上是非常厌烦的。任何人都可以告诉我为什么这个代码生成页脚内容或.leftfooter
复制.centerfooter
?Excel VBA组成自己的页脚
Sub Print_Setup()
Dim CurrentWB As Workbook
Dim Page As Worksheet
Set CurrentWB = ActiveWorkbook
For Each Page In CurrentWB.Worksheets
With Page.PageSetup
.CenterHorizontally = False
'Make sure there is room to make notes on the sides of the page
'Page Margins
.TopMargin = 0
.LeftMargin = 14.4
.RightMargin = 0
.BottomMargin = 18
'Footer
.FooterMargin = 0
.RightFooter = "&8Printed &D: &P of &N"
.CenterFooter = ""
.LeftFooter = "&8&Z&F[&A]"
End With
Next Page
End Sub
感谢您的pormt响应,我在Win7上使用Excel 2010。 – sgp667 2014-12-04 17:12:47
如果您将页脚设置为空值并执行打印预览,该怎么办?你有同样的结果吗?另一种选择是先将它们设置为空,然后将它们设置为所需的值。 你在做其他页面设置的东西吗? – asylumax 2014-12-04 17:22:18
是的,我设置了无效。不知道为什么这个工作,但它确实 – sgp667 2014-12-04 17:37:18