我有多张Excel工作表,需要将这些工作表打印到一个PDF文档中。有些工作表有多页,有些工作表只有一页。
我已经写了一个VBA来打印这些表格到PDF,它的效果非常好。但是,我想将pagenumers添加到与PDF页面匹配的这些页面中。但是我无法让它工作..有谁知道如何将它添加到我的代码中?
Sub PrintFS()
ThisWorkbook.Sheets(Array("1. Front Sheet", "2. Page", "3. Page", "4. Page", "5. Page", "6. Page")).Select
'Set PDF Name
TemplatePath = Left(Left(ThisWorkbook.Path, InStrRev(ThisWorkbook.Path, "\")), InStrRev(Left(ThisWorkbook.Path, InStrRev(ThisWorkbook.Path, "\")), "\"))
Entity = Worksheets("Topsheet").Range("B2").Value
Year2day = Worksheets("Topsheet").Range("B3").Value
'Print PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
TemplatePath & "\Accounts - " & Year2day & " - " & Entity & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub