excel VBA打印pdf文档中的行号和列字母

ryhaxcpt  于 2023-02-20  发布在  其他
关注(0)|答案(1)|浏览(132)

所以我试着打印一个Excel表格。到目前为止,我已经设置了大部分的东西,但我不能得到行号和列字母的工作。
我尝试了很多东西,如行号,打印标题列,但我认为这不是我真正寻找的。
下面是我的代码:

Sub PrintToPDF()
' Saves active sheet as PDF file.
Dim Name As String
Dim wkPrint As Worksheet

FileNameArray = Split(ThisWorkbook.Name, ".")
Name = ThisWorkbook.Path & "\" & Format(Now(), "yyyy-mm-dd") & "_" & FileNameArray(0) & ".pdf"

Set wkPrint = ThisWorkbook.Worksheets("Dokumentation")

'On Error GoTo err
'wkPrint.PrintCommunication = True

With wkPrint.PageSetup
    .PaperSize = xlPaperA3
    .RightHeader = "&D &T"
    .PrintGridlines = True
    '.LineNumbering.Active = True
    '.PrintTitleColumns = "A:AA"
End With

'Application.PrintCommunication = True

wkPrint.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Name, _
    Quality:=xlQualityStandard, IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, OpenAfterPublish:=False
Exit Sub
'err:
'MsgBox err.Description
End Sub

先谢了!

41zrol4v

41zrol4v1#

您正在查找wkPrint.PageSetup.PrintHeadings = True

相关问题