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