VBA to Combine PDFs based on Yes/No Criteria

bxp265

New Member
Joined
Jun 26, 2020
Messages
9
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hi,

I am new to VBA and excel macros. I have an excel document that is set up so column "A" contains hyperlinks to PDFs. In column "I" there is a yes or no. If there is a yes, then I want the PDF in column A to be added to a master PDF document. The idea is that this master PDF document contains all PDFs for which there was a "yes" in column "l".

Does this make sense and can anyone help me? I have successfully written a macro for each PDF to open individually, but I have not been able to merge them or print them. Any help would be MUCH appreciated.
 

bxp265

New Member
Joined
Jun 26, 2020
Messages
9
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Do you mean that reference isn't listed? The code requires Acrobat Professional to be installed and then the reference will be listed.
It just won't let me click "reference" but it is probably because I do not have professional. Do you think that's the only way to get it to work?
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,743
Office Version
  1. 2010
Platform
  1. Windows
As cortexnotion pointed out, you need Acrobat, not the Reader. If you don't have it, you can't use the code.
 

bxp265

New Member
Joined
Jun 26, 2020
Messages
9
Office Version
  1. 365
Platform
  1. Windows
  2. Web
I can still not get this to work. Below is the code I am using that opens up all of my linked PDFs in individual tabs on the OneDrive that I have them saved to. It works great. Does anyone know what I need to add to get them to combine into one PDF?

Sub OpenPDF()
'
' Macro Macro
'
Dim i As Long
' Go through the Print PDF column
For i = 2 To 28
' Check if Print PDF column is yes
If Sheet2.Range("J" & i).Value = "Yes" Or Sheet2.Range("J" & i).Value = "yes" Then
' Check if column A has hyperlink
If Range("A" & i).Hyperlinks.Count > 0 Then
'Click on hyperlink in column A if it exists
Sheet2.Range("A" & i).Hyperlinks(1).Follow
End If
Else
End If
Next

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,114,084
Messages
5,545,867
Members
410,711
Latest member
Josh324
Top