VBA设置页眉时动态调用单元格中的内容

2024-12-04 08:44:28
推荐回答(2个)
回答(1):

理论上应该先在每一页之后插入分节符,然后再调用修改每一节的页眉。没具体操作,你可以先尝试下这样做做看。

回答(2):

Sub 打印()
i = 1
With ActiveSheet.PageSetup
.CenterHeader = Cells(1, i).Value
End With
ActiveSheet.PrintOut From:=i, To:=i, Copies:=1
k = ExecuteExcel4Macro("GET.DOCUMENT(50)")
For i = 2 To k
With ActiveSheet.PageSetup
.CenterHeader = Cells(1, i).Value
End With
ActiveSheet.PrintOut From:=i, To:=i, Copies:=1
Next
End Sub