Sending email with hyperlink to file

cheoksoon

Board Regular
Joined
Aug 25, 2016
Messages
56
Hi there,

I've a simple email script as follows:

Code:
Sub Mail()


Dim outlookApp As Outlook.Application
Set outlookApp = CreateObject("Outlook.Application")


Dim outlookMail As Outlook.MailItem
Set outlookMail = outlookApp.CreateItem(outlookMailItem)


    With outlookMail
        .To = "john.doe@gmail.com"
        .Subject = "Hello"
        .Body = "This is a link of the file."
        .Send
        
End Sub

I would like to include a link to a file on the computer like (D:\users\users\David Nolan.xlsm) in that email. How do I do it?

THanks..
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Body = "Hello ..<br />next line ..." & _
"This is the link to the file <a href=""\\D:\users\users\David Nolan.xlsm"">Click here</a> to ..."
 
Upvote 0
Code:
   Body = "Hello ..<br />next line ..." & _
          "This is the link to the file <a href=""\\D:\users\users\David Nolan.xlsm"">Click here</a> to ..."
 
Upvote 0
Presuming your using outlook automation, switch to the HTML mail format:

.BodyFormat = olFormatHTML '// 2
.HTMLBody = strBody
And use markup for the body:

strBody = "Hello ..<br />next line ..." & _
"Click <a href=""http://www.foo.com"">here</a> to ..."
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,685
Members
449,463
Latest member
Jojomen56

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