ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sending Email via VBA (https://www.excelbanter.com/excel-programming/396707-sending-email-via-vba.html)

chad

Sending Email via VBA
 
I'm sending an email using VBA via the code listed below. Everything works
fine, but I'd like to incorporate a hyperlink in the body of the email, which
I don't know how to do. Right now the link (text) is in the body of the
email, but i do not know how to make it a hyperlink. Any help is appreciated.

'here's my example
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Dim strbody As String

strbody = "Please visit us at www.test.com. Thank you." 'i want the
www.test.com to be a clickable hyperlink

With OutMail
.To = "
.Subject = "test email"
.Body = strbody
.Display 'or use '.Send
End With

Thanks in advance,
Chad

Ron de Bruin

Sending Email via VBA
 
Use .HTMLBody

There is a example here
http://www.rondebruin.nl/mail/tips2.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chad" wrote in message ...
I'm sending an email using VBA via the code listed below. Everything works
fine, but I'd like to incorporate a hyperlink in the body of the email, which
I don't know how to do. Right now the link (text) is in the body of the
email, but i do not know how to make it a hyperlink. Any help is appreciated.

'here's my example
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Dim strbody As String

strbody = "Please visit us at www.test.com. Thank you." 'i want the
www.test.com to be a clickable hyperlink

With OutMail
.To = "
.Subject = "test email"
.Body = strbody
.Display 'or use '.Send
End With

Thanks in advance,
Chad


chad

Sending Email via VBA
 
Perfect, thanks!


"Ron de Bruin" wrote:

Use .HTMLBody

There is a example here
http://www.rondebruin.nl/mail/tips2.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chad" wrote in message ...
I'm sending an email using VBA via the code listed below. Everything works
fine, but I'd like to incorporate a hyperlink in the body of the email, which
I don't know how to do. Right now the link (text) is in the body of the
email, but i do not know how to make it a hyperlink. Any help is appreciated.

'here's my example
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Dim strbody As String

strbody = "Please visit us at www.test.com. Thank you." 'i want the
www.test.com to be a clickable hyperlink

With OutMail
.To = "
.Subject = "test email"
.Body = strbody
.Display 'or use '.Send
End With

Thanks in advance,
Chad




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

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