Forum

Modify Text to disp...
 
Notifications
Clear all

Modify Text to display to Full path of file instead of "link to file"

4 Posts
2 Users
0 Reactions
72 Views
(@josros60)
Posts: 47
Trusted Member
Topic starter
 

Hi,

how can I modify the code below to change the display "Link to file" to \mtlnas01EFT_backup202111 November 2021 939 1-6 NCL USD Wires Summary January 00, 1900.xlsx (to display where saved) people don't know that pointing the mouse will display the full path, much appreciated.

 

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 Lawrie,<br><br>" & _
                  "<br><B>" & _
                 ActiveWorkbook.Name & "</B> is created.<br>" & _
                  "Please click on this link to open the file : " & _
                  "<A HREF=""file://" & ActiveWorkbook.FullName & _
                  """>Link to the file</A>" & "</B> <br> <br>" & _
                  "NCL USD WIRES SUMMARY.PDF" & "</B> is saved.<br>" & _
                  "Please click on this link to open the backup : " & _
                  "<A HREF=""file://" & NetworkPath & ActiveWorkbook.ActiveSheet.Range("F3") & _
                  """>Link to the file</A>" & _
                  "<br><br>Note: The WIRES backup link is in the spreadsheet as well...." & _
                  "<br><br>Thank you," & _
                  "<br><br></font>"

        On Error Resume Next
        With OutMail
            .To = "[email protected]"
            .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
End Sub
 
Posted : 29/11/2021 6:19 pm
(@debaser)
Posts: 837
Member Moderator
 

Use:

 

        strbody = "<font size=""3"" face=""Calibri"">" & _
                  "Hi Lawrie,<br><br>" & _
                  "<br><B>" & _
                 ActiveWorkbook.Name & "</B> is created.<br>" & _
                  "Please click on this link to open the file : " & _
                  "<A HREF=""file://" & ActiveWorkbook.FullName & _
                  """>" & ActiveWorkbook.FullName & "</A>" & "</B> <br> <br>" & _
                  "NCL USD WIRES SUMMARY.PDF" & "</B> is saved.<br>" & _
                  "Please click on this link to open the backup : " & _
                  "<A HREF=""file://" & NetworkPath & ActiveWorkbook.ActiveSheet.Range("F3") & _
                  """>" & NetworkPath & ActiveWorkbook.ActiveSheet.Range("F3") & "</A>" & _
                  "<br><br>Note: The WIRES backup link is in the spreadsheet as well...." & _
                  "<br><br>Thank you," & _
                  "<br><br></font>"
 
Posted : 30/11/2021 5:12 am
(@josros60)
Posts: 47
Trusted Member
Topic starter
 

Thank you so much.

 

worked perfectly.

 
Posted : 30/11/2021 11:30 pm
(@debaser)
Posts: 837
Member Moderator
 

You're welcome. 🙂

 
Posted : 01/12/2021 4:26 am
Share: