Mic*_*ney 6 pdf excel acrobat vba excel-vba
Sheets("Key Indicators").ExportAsFixedFormat Type:=xlTypePDF,
Filename:=ArchivePath, Quality:=xlQualityStandard,
IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Run Code Online (Sandbox Code Playgroud)
目前这就是我所拥有的.
我理解如何ExportAsFixedFormat PDF,但我需要知道的是使用VBA访问Acrobat下的Create PDF功能(如下图所示).如果我执行ExportAsFixedFormat,链接会变平.Acrobat"创建PDF"允许我将Excel转换为包含超链接的PDF.
我该怎么办?
我使用的是Excel 2016和Adobe Pro DC
Acrobat Reference 应该可以工作
这里是 Adobe 的指南
添加后,您可以使用以下代码 提示:它可能会引导您正确编码 - 我不太确定,因为我“盲目”编码了它,因为我没有 Acrobat我的电脑-。一步步调试看看发生了什么。
Sub ExportWithAcrobat()
Dim AcroApp As Acrobat.CAcroApp 'I'm not quite sure it's needed since we are creating the doc directly
Dim AcrobatDoc As Acrobat.CAcroPDDoc
Dim numPages As Long
Dim WorkSheetToPDF As Worksheet
Const SaveFilePath = "C:\temp\MergedFile.pdf"
Set AcroApp = CreateObject("AcroExch.App") 'I'm not quite sure it's needed since we are creating the doc directly
Set AcrobatDoc = CreateObject("AcroExch.PDDoc")
'it's going to be 0 at first since we just created
numPages = AcrobatDoc.GetNumPages
For Each WorkSheetToPDF In ActiveWorkbook.Worksheets
If AcrobatDoc.InsertPages(numPages - 1, WorkSheetToPDF, 0, AcrobatDoc.GetNumPages(), True) = False Then 'you should be available to work with the code to see how to insert the sheets that you want in the created object ' 1. If Part1Document.InsertPages(numPages - 1, "ExcelSheet?", 0, AcrobatDoc.GetNumPages(), True) = False
MsgBox "Cannot insert pages" & numPages
Else ' 1. If Part1Document.InsertPages(numPages - 1, "ExcelSheet?", 0, AcrobatDoc.GetNumPages(), True) = False
numPages = numPages + 1
End If ' 1. If Part1Document.InsertPages(numPages - 1, "ExcelSheet?", 0, AcrobatDoc.GetNumPages(), True) = False
Next WorkSheetToPDF
If AcrobatDoc.Save(PDSaveFull, SaveFilePath) = False Then ' 2. If Part1Document.Save(PDSaveFull, "C:\temp\MergedFile.pdf") = False
MsgBox "Cannot save the modified document"
End If ' 2. If Part1Document.Save(PDSaveFull, "C:\temp\MergedFile.pdf") = False
End Sub
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15986 次 |
| 最近记录: |