BACKUP LINK

josros60

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

have the code below which works good, this one add the link for the spreadsheet on body of the email to click to open, how can I modify it that it can also add the link of the backup that is pdf format located in the same folder.

Here the code:

VBA 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><B>" & _
                  ActiveWorkbook.Name & "</B> is created.<br>" & _
                  "Please click on this link to open the file : " & _
                 [B][COLOR=rgb(226, 80, 65)] "<A HREF=""file://" & ActiveWorkbook.FullName & _
                  """>Link to the file</A>" & _[/COLOR][/B]
                  "<br><br>Note: The EFT backup link is on the spreadsheet...." & _
                  "<br><br>Thank you," & _
                  "<br><br></font>"

        On Error Resume Next
        With OutMail
            .To = ""
            .CC = ""
            .BCC = ""
            .Subject = "RE: " & Range("SUBJECT").Value 'ActiveWorkbook.Name
            .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


End Sub

Thank you,
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Running your macro code here shows a Syntax Error in this section of code :

VBA Code:
        strbody = "<font size=""3"" face=""Calibri"">" & _
                  "Hi Afia,<br><br>" & _
                  "<br><B>" & _
                  ActiveWorkbook.Name & "</B> is created.<br>" & _
                  "Please click on this link to open the file : " & _
                 [B][COLOR=rgb(226, 80, 65)] "<A HREF=""file://" & ActiveWorkbook.FullName & _
                  """>Link to the file</A>" & _[/COLOR][/B]
 
Upvote 0
I don't get any works fine just if possible to modify it can also add the backup link for EFT spreadsheet which are in the samefolder.

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,986
Messages
6,122,611
Members
449,090
Latest member
vivek chauhan

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