【问题标题】:How to export from Excel to PDF to a determined location?如何从 Excel 导出到 PDF 到确定的位置?
【发布时间】:2017-12-15 04:53:17
【问题描述】:

我有此代码要导出到 PDF,但它会转到 documents 文件夹。我想将其导出到其他位置。我该怎么做?

这是代码:

Private Sub CommandButton1_Click()

    Range("a1:k44").Select
    Selection.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:=ru & "REMITO " & Range("C7") & ".pdf", _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, OpenAfterPublish:=False

End Sub

【问题讨论】:

  • 在文件名中包含路径?

标签: excel export-to-pdf vba


【解决方案1】:

将excel作为PDF导出到特定路径,可以使用下面的代码。您需要根据需要对其进行调整,这是基础。

Private Sub CommandButton1_Click()

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="path_here+filename.pdf"

End sub

示例:

Filename:="C:\Documents\newfolder2\archive.pdf"

【讨论】:

    猜你喜欢
    • 2020-06-14
    • 1970-01-01
    • 2019-02-27
    • 1970-01-01
    • 1970-01-01
    • 2015-08-30
    • 1970-01-01
    • 1970-01-01
    • 2010-12-12
    相关资源
    最近更新 更多