我有一个子程序,可以将“AnáliseCC” excel工作表打印为pdf文件,该工作表保存在文件夹中,文件名根据我要执行的打印而有所不同。到目前为止,一切都很好。
然后,我正在开发另一个子例程,以将以前的pdf文件与位于同一文件夹中的另一个pdf文件一起编译。我无法使MergePDFs功能正常工作。我究竟做错了什么?下面的代码。谢谢!
Sub ExportAsPDF()
Dim FolderPath As String
FolderPath = "C:\Users\DMM\Certificados"
'Sheets(Array("Análise CC", "QR Code")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & "\" & Sheets("Análise CC").Range("O4"), _
openafterpublish:=False, ignoreprintareas:=False
MsgBox "All PDF's have been successfully exported."
End Sub
Sub Combine_PDFs()
Dim strPDFs(0 To 1) As String
Dim bSuccess As Boolean
Dim FolderPath As String
FolderPath = "C:\Users\ITG-0720\OneDrive - INSTITUTO TECNOLOGICO DO GAS\ITG\DMM\Certificados"
strPDFs(0) = FolderPath & "\" & Sheets("Análise CC").Range("D9")
strPDFs(1) = FolderPath & "\" & Sheets("Análise CC").Range("O4")
bSuccess = MergePDFs(strPDFs, "FolderPath & "\" & Sheets("Análise CC").Range("O4")")
If bSuccess = False Then MsgBox "Failed to combine all PDFs", vbCritical, "Failed to Merge PDFs"
End Sub