Adding PDF backup as an attchement as excel file as well

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
786
Office Version
  1. 365
Hi,

have the vba code below that the workbook as attachment automatically there's also pdf backup is there away to add the pdf file automatically as attachment as well.

code:

Rich (BB code):
Sub Make_Outlook_Mail_With_File_Link()
'Working in Excel 2000-2016
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String

    If ActiveWorkbook.Path <> "" Then
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)

        strbody = "<font size=""3"" face=""Calibri"">" & _
                  "Hi Afia,<br><br>" & _
                  "<br>" & _
                   "Please process NCL EFT saved on:" & "</B><br><br>" & _
                  "Link to open the file: " & _
                  "<A HREF=""file://" & ActiveWorkbook.FullName & _
                  """>Link to the file</A>" & "</B> <br> <br>" & _
                  "" & "</B><br>" & _
                  "Link to open the backup: " & _
                  "<A HREF=""file://" & NetworkPath & ActiveWorkbook.ActiveSheet.Range("E3") & _
                  """>Link to the file</A>" & _
                  "<br><br>Note: The EFT backup link is on the spreadsheet as well...." & _
                  "<br><br>Thank you," & _
                  "<br><br></font>"

        On Error Resume Next
        With OutMail
            .To = "afia.amaniampong@distributel.ca"
            .CC = ""
            .BCC = ""
            .Subject = "" & Range("SUBJECT").Value  'ActiveWorkbook.Name
            .Attachments.Add Application.ActiveWorkbook.FullName
            .HTMLBody = strbody
            .Display   'or use .Send
        End With
        On Error GoTo 0

        Set OutMail = Nothing
        Set OutApp = Nothing
    Else
        MsgBox "The ActiveWorkbook does not have a path, Save the file first."
    End If


Thank you,
 
Last edited by a moderator:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
found the solution for someone in the future I just added this:

VBA Code:
attachments.Add Sheets("EFT Summary").Range("E3").Value

thank you
 
Upvote 0
Solution

Forum statistics

Threads
1,223,887
Messages
6,175,199
Members
452,617
Latest member
Narendra Babu D

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