Good afternoon,
I currently have a button that prints 1-n reports in PDF format. I know how to combine those PDFs into 1 using VBA if I have the exact number of reports being printed. Some weeks I will print 1 and some weeks I can print up to 6.
My question is: Can I make an array count variable?
The above is how I am doing it when I know the number of pages to combine
I currently have a button that prints 1-n reports in PDF format. I know how to combine those PDFs into 1 using VBA if I have the exact number of reports being printed. Some weeks I will print 1 and some weeks I can print up to 6.
My question is: Can I make an array count variable?
Code:
slideCount = 2
jcrbReportArray(0) = "JCRB Cover Page 1.pdf"
jcrbReportArray(1) = "JCRB Overview 2.pdf"
I = 0
For Each JCRBReport in jcrbReportArray
set pdfFile(I) = CreateObject(AcroExch.PDDoc")
pdfFile(I).Open srcFolderName & JCRBReport
If I <> 0 Then
numPages = pdfFile(I).GetNumPages()
If Not pdfFile(0).InsertPages(totalNumPages - 1, pdfFile(I), 0, numPages, True) Then
MsgBox "Cannot insert pages", vbExcalamation, "Canceled"
End If
totalNumPages = totalNumPages + numPages
pdfFile(I).Close
Set pdfFile(I) = Nothing
Else
totalNumPages = pdfFile(0).GetNumPages()
End if
I = I + 1
Next JCRBReport
The above is how I am doing it when I know the number of pages to combine