VBA - 图形保存为PDF的问题

时间:2018-04-07 07:47:43

标签: vba pdf graph

我的代码有问题,为了给你一些上下文,我有一个宏将特定的打印区域保存为PDF。在这个印刷区域有一个图表。当我要求打印时,图表会显示,但是,当我使用我的宏时,图表不会显示在PDF中,但是在打印时,此PDF会显示图表。这是我的代码:

Sub SaveActiveSheetAsPDFIn2016()
    'Antoine Hervieux : 5-April-2016
    'Test macro to save as pdf with ExportAsFixedFormat
    Dim FileName As String
    Dim FolderName As String
    Dim Folderstring As String
    Dim FilePathName As String

    Sheets("Summary").PageSetup.Orientation = xlLandscape

    'Name of the folder in the Office folder
    FolderName = "PDFFolder"
    'Name of the pdf file
    FileName = Sheets("Summary").Range("C4") & ".pdf"

    Folderstring = CreateFolderinMacOffice2016(NameFolder:=FolderName)
    FilePathName = Folderstring & Application.PathSeparator & FileName
    ActiveSheet.ChartObjects("chart 1").PrintObject = True

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
    FilePathName, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False

    MsgBox "You find the PDF file in this location : " & FilePathName
End Sub

你知道图表没有出现的原因吗?顺便说一下,我在MAC上。 非常感谢

0 个答案:

没有答案