How to attach 2 type of files to an Outlook email

jlyn123

New Member
Joined
Jan 24, 2018
Messages
45
Office Version
  1. 2016
Hello,

I am trying to attach a PDF version of an excel spreadsheet form I have as well as the spreadsheet itself but I cant seem to figure out the VBA code that will attach both types of files. I have been successful in attaching the PDF but I cant seem to figure out how to get the spreadsheet to attach as well. How do you combined those two requests in one code?

Can you please help me out here?

Thanks!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hello,

How would you attached multiples tabs within the same excel spreadsheet to PDF in the same email?

Thanks,
Jenny
 
Upvote 0
Multiple sheets (tabs) in one PDF file, or multiple sheets with 1 sheet per PDF? This does the former for 3 named sheets:

Code:
Public Sub Save_3_Sheets_As_PDF()

    Dim currentSheet As Worksheet
    
    With ThisWorkbook
        Set currentSheet = .ActiveSheet
        .Worksheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
        .ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\Multiple Sheets.pdf", _
            Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
        currentSheet.Select
    End With
    
End Sub
Then do
Code:
.Attachments.Add ThisWorkbook.Path & "\Multiple Sheets.pdf"
in the Outlook code.
 
Upvote 0
Hello,

Yes, I was looking for multiple sheets per PDF but with this code I am getting a Compile error: For without Next. I tried to put in a Next code but its not working I get Next without For error. Any thoughts?

Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

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