ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Link in e-mail (https://www.excelbanter.com/excel-programming/429588-re-link-e-mail.html)

Luke M

Link in e-mail
 
In the text for your body, add the prefix File before your address to create
link

"File:\\Spartanburg\shared\...."

This is also a handy trick when someone sends you an email with address, but
didn't link it. Just type File in front of it, and voila! a link is created.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Mike" wrote:

Hi.

I am having trouble getting a hyperlink to appear in an e-mail. The code
all seems to work, but only the text of the link appears. I want this to be
an actual link that the recipient can click on.

Any ideas?

'Working in Office 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

strbody = "Folks," & vbNewLine & vbNewLine & _
"The all orgs output file has been updated." & vbNewLine & _
"" & vbNewLine & _
"\\Spartanburg\shared\Production\Productivity\ 2008 Production
Weekly\AAR Output\all orgs - output - daily.xls " & vbNewLine & _
""


On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "All Orgs - Output - Daily"
.Body = strbody

'This is where I'm having problem. I want to hyperlink the file
'Should this be after the strbody? I tried after the strbody and it
did not work.
ActiveWorkbook.Follow.Hperlink.Follow Address:= _

"\\Spartanburg\shared\Production\Productivity\2008 %20Production%20Weekly\AAR%20Output\all%20orgs%20-%20output%20-%20daily.xls" _
, TextToDisplay:= _
("\\Spartanburg\shared\Production\Productivity\200 8 Production
Weekly\AAR Output\all orgs - output - daily.xls")

'You can add a file with this
'.Attachments.Add
("\\Spartanburg\shared\Production\Productivity\200 8 Production Weekly\AAR
Output\all orgs - output - daily.xls")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub



All times are GMT +1. The time now is 09:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com