Embed Multiple PDF's at once

TheRevSWT

New Member
Joined
Apr 5, 2009
Messages
8
I searched but couldn't find a relative topic.

Is there an easy way to embed multiple objects at once? I have roughly 60 pdfs I'd like to embed in an excel document, and really don't look forward to doing it manually.

Any help would be appreciated.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try this macro, after changing the matchPDFfiles string to the folder location of the PDF files and wildcard file name.
VBA Code:
Public Sub Embed_PDFs()
    
    Dim matchPDFfiles As String
    Dim PDFsFolder As String, PDFfileName As String
    Dim destCell As Range
    
    matchPDFfiles = "C:\path\to\PDFs\*.pdf"   'CHANGE THIS - folder containing the PDFs and wildcard file name
        
    With ActiveSheet
        Set destCell = .Range("B2")
    End With
        
    'Loop through matching PDFs and insert as objects
    
    PDFsFolder = Left(matchPDFfiles, InStrRev(matchPDFfiles, "\"))
    PDFfileName = Dir(matchPDFfiles)
    While PDFfileName <> vbNullString
        destCell.Select
        ActiveSheet.OLEObjects.Add Filename:=PDFsFolder & PDFfileName, Link:=False, DisplayAsIcon:=False
        Set destCell = destCell.Offset(4)
        PDFfileName = Dir()
    Wend
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,798
Messages
6,181,038
Members
453,014
Latest member
Chris258

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top