How to Attach a PDF File in Excel – 3 Easy Methods

The sample PDF file (Employee Record) contains the following table.
Method 1 – Using the Object Feature to Attach a PDF File in Excel

- In the drop-down menu, select Object.


- In Browse, select the PDF file you want to attach.
- Click Insert.


You have attached the PDF file.

- Right-click the PDF file.
- Select Format Object.


- The PDF file will be fixed in this cell. If you resize the cell the file will automatically be resized.
- Open the PDF by double-clicking it.

Note: You can also open the Object dialog box, by pressing Alt + N +J.
Method 2 – Using the Hyperlink Feature in Excel
Steps:
- Select the cell in which you want the PDF file.
- Go to the Insert tab.
- Select Illustrations.
- Choose Pictures.

- In the drop-down menu, select This Device.


The picture is inserted.
- Resize the image by clicking and dragging its corner.



- In the Insert Hyperlink dialog box, select Existing File or Web Page.
- Select the PDF file you want to attach.
- Click OK.

- The link to the file will be inserted into the image. You can see it by hovering the cursor over the picture.
- Click the picture to open the PDF file.

This is the output.

Method 3 – Using VBA to Attach a PDF File
Steps:

Opening Module to Attach PDF file in Excel" width="340" height="267" />
- Enter the following code in the module.
Sub Attach_PDF_file() Dim PDF_file As String PDF_file = Dir("E:\office\Article 68\") Do While Len(PDF_file) > 0 If Right(PDF_file, 3) = "pdf" Then ActiveSheet.OLEObjects.Add(Filename:= _ "E:\office\Article 68\" & PDF_file _ , Link:=False, DisplayAsIcon:=False).Select End If PDF_file = Dir Loop End Sub

Code Breakdown
- A Sub Procedure named Attach_PDF_file is created.
- A variable named PDF_file as String is declared.
- A Do While Loop is used to repeat the loop while the condition is true.
- An If Statement is used to run the code for a specific condition.
- The If Statement is ended.
- The Sub Procedure is ended.
- Save the code and go back to your worksheet.
- Go to the Developer tab.
- Select Macros.

- In the Macro dialog box, select Attach_PDF_file as the Macro name.
- Click Run.

The PDF file is inserted and the first page is displayed.

This is the output.

- Double-click the file to open the PDF.

This is the output.

How to Copy Data from a PDF File to Excel
Use the Power Query Editor.
Steps:


- In the Navigator dialog box, select from where you want to get data. Here, Page001.
- Click Transform Data.

- The Power Query Editor will open.

- Click the table button as shown in the following picture.
- Select Use First Row as Headers.

This is the output.


- In Import Data, select Existing Worksheet.
- Choose a location for your data.
- Click OK.

- Data in the PDF file was copied to Excel.


Things to Remember
Whenever working with VBA, save your Excel file as an Excel Macro-Enabled Workbook. Otherwise, VBA will not work.
Practice Section

Download Practice Workbook
Download the practice workbook here.
Attaching PDF File.xlsm
Related Articles
- How to Insert an Excel File into Another Excel File
- How to Attach Email in Excel
- [Fixed!] Cannot Insert PDF into Excel
- How to Attach Zip File in Excel
- How to Attach Screenshot in Excel
Save Saved Removed 0
Mashhura Jahan
Mashhura Jahan, BSc in Industrial and Production Engineering from Bangladesh University of Engineering and Technology, invested 1.5 years at ExcelDemy. In roles like Excel & VBA Content Developer, Excel Charts, and Dashboard course trainer, she wrote 90+ articles. She was previously part of the forum support team and a junior software analyst on the Excel Add-in project. With interests spanning Excel, VBA, Power Query, Python, Data Science, and Software Development, Mashhura brings a diverse skill set to her. Read Full Bio