VBA text to display hyperlink in Outlook email

Sven62

Active Member
Joined
Feb 21, 2012
Messages
485
My macro will create an email to defined addresses. I want the words "RESPONSE column" to be hyperlinked to the document address ..... etc etc . How do I do that? TIA!!!

Rich (BB code):
Set xOutApp = CreateObject("Outlook.Application")
        Set xMailItem = xOutApp.CreateItem(0)
        xMailBody = "The RESPONSE column of the Employee Onboarding worksheet was modified on " & _
            Format$(Now, "mm/dd/yyyy") & " at " & Format$(Now, "hh:mm:ss") & _
            " by " & Environ$("username") & "." & vbNewLine & vbNewLine & "You're up, slugger!"
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try this:
VBA Code:
Public Sub Create_Email()

    Dim OutApp As Object, OutMail As Object
    Dim HTML As String
   
    HTML = "<p>The <a href='http://www.yourlink.com/page.html'>RESPONSE column</a> of the Employee Onboarding worksheet was modified on " & _
           Format$(Now, "mm/dd/yyyy") & " at " & Format$(Now, "hh:mm:ss") & _
           " by " & Environ$("username") & ".</p><p>You're up, slugger!</p>"
   
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
   
    On Error Resume Next

    With OutMail
        .To = "email@address.com"
        .CC = ""
        .BCC = ""
        .Subject = "Email subject"
        .HTMLBody = HTML
        .Display
    End With

    On Error GoTo 0
   
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,426
Messages
6,119,414
Members
448,895
Latest member
omarahmed1

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