How to Attach Embedded Excel Files to Outlook Email with VBA
Question details
The user wants to attach files that are embedded in an Excel worksheet to an Outlook email through VBA, but Outlook cannot use embedded OLE objects or displayed cell values directly; each attachment must be a valid file path or a temporary exported file.
- Product
- Microsoft Excel and Microsoft Outlook
- Device & OS
- not provided
- Scenario
- A user is automating email attachments from an Excel workbook with VBA and expects embedded worksheet objects or cell values to attach directly to an Outlook message.
- Observed behavior
- Outlook Attachments.Add requires a valid file path, so embedded OLE objects or displayed cell values are not recognized as attachable files.
Confirm whether cells A1:A8 contain full file paths such as C:\Reports\file.pdf or embedded OLE objects. In the VBA editor, enable the Microsoft Outlook Object Library reference before running attachment code.
Attach Valid File Paths from Worksheet Cells to an Outlook Email
Use this method when cells A1:A8 contain full file paths, because Outlook only accepts valid paths on disk rather than displayed values or embedded objects.
Outlook's Attachments.Add method requires a file path or a saved temporary file. A worksheet cell that shows a path must be validated with Dir before it is attached.
Press Alt+F11 in Excel to open the Visual Basic for Applications editor, then click Insert > Module to create a new module.
In the VBA editor, click Tools > References, then check Microsoft Outlook 16.0 Object Library so Outlook objects are available to the macro.
Read attachmentCell.Value into a filePath string, and use If Len(Dir(filePath)) > 0 Then objMail.Attachments.Add filePath, olByValue to attach only existing files.
Place the cursor inside the procedure and press F5, or go to the Developer tab > Macros, select the macro, and click Run to create the Outlook email.

Export Embedded OLE Objects to Temporary Files Before Attaching
Use this method when the worksheet contains embedded objects rather than file paths; export each object to a temporary folder, then pass the saved file path to Attachments.Add.
Use WPS Office as a Free Alternative for Excel-Compatible Spreadsheet Workflows
Because Outlook attachment automation belongs to Microsoft Office itself, WPS Office offers a free, lightweight alternative for opening, editing, and saving Excel-compatible spreadsheets with a familiar interface and strong format compatibility.

Frequently Asked Questions
Why does Outlook say it cannot attach a file when I use a worksheet cell value?
Outlook Attachments.Add requires a valid file path, not a displayed cell value or an embedded OLE object. Use Len(Dir(filePath)) to confirm the path exists before calling Attachments.Add.
How do I attach multiple files listed in cells A1:A8 with VBA?
Loop through the cells with a Long row counter, read each cell value into a string, validate it with Dir, and then call objMail.Attachments.Add filePath, olByValue for each existing file.
Can I attach embedded Excel worksheet objects directly to an Outlook email?
No, Outlook cannot attach an embedded OLE object directly as an email attachment. Export each embedded object to a temporary file first, then pass that temporary file path to Attachments.Add.
Do I need an Outlook object library reference in Excel VBA?
Yes. In the VBA editor, click Tools > References and check Microsoft Outlook 16.0 Object Library so Outlook objects such as MailItem and Attachments are available to your macro.




