Results 1 to 5 of 5

Thread: Sleeper: Create a hyperlink in email text body

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Jan 2006
    Posts
    30
    Location

    Sleeper: Create a hyperlink in email text body

    Hi folks,

    plse have a look at the code below. I want to use it to send emails notifications from VBA Excel. I would like to include a hyperlink to the body (or even subject) of the email. How to do this? Add something like [/url:mysite.nl/url] in the body text?

    Private Sub CommandButton1_Click()
    Dim myRecipient As String Dim mySubject As String Dim myBody As String Dim myAttachments As String myRecipient = "myfriends@vbaforum.com" mySubject = "Please help me out..." myBody = "Now, I would like a Hyperlink here!" myAttachments = "" SendEmail myRecipient, mySubject, myBody, myAttachments End Sub Private Sub SendEmail(ByVal Recipient As String, ByVal Subject As String, _ ByVal Body As String, Optional ByVal Attachments As String) Dim aOutlook As Object Dim aEmail As Object On Error Resume Next Set aOutlook = GetObject(, "Outlook.Application") On Error Goto lNoOutlook If aOutlook Is Nothing Then Set aOutlook = CreateObject("Outlook.Application") Set aEmail = aOutlook.CreateItem(olmailitem) On Error Goto 0 aEmail.Subject = Subject aEmail.Body = Body If Not (Attachments = "") Then aEmail.Attachments.Add Attachments On Error Goto lNoSend aEmail.Recipients.Add Recipient aEmail.display 'or
    'aEmail.Send 'MsgBox "Email successfully sent."
    Exit Sub lNoSend: MsgBox "Email not sent.": Exit Sub lNoOutlook: MsgBox "Microsoft Outlook is not installed." End Sub
    VBA tags courtesy of www.thecodenet.com



    Help greatly appreciated!

    Thymen
    Last edited by Thymen; 02-27-2006 at 10:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •