+ Reply to Thread
Results 1 to 2 of 2

Hyperlink text that displays in email through VBA code

Hybrid View

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    Bristol
    MS-Off Ver
    Excel 2007
    Posts
    62

    Question Hyperlink text that displays in email through VBA code

    Hi,

    I have this code

    Sub Send()
    Dim OutApp As Object
     Dim OutMail As Object
     
     Call SaveFile
     
     Set OutApp = CreateObject("Outlook.Application")
     OutApp.Session.Logon
     Set OutMail = OutApp.CreateItem(0)
    
     On Error Resume Next
     With OutMail
     .To = "will.norris@email.org"
     .Subject = "New User Requirements"
     .Body = "A new users requirements form has been submitted for " & Range("D5") & " to be set up for the start date of " & Range("D9") & "The form is held in H:\Folder\Folder"
    
    
    .Send
    
     End With
     On Error GoTo 0
    
     Set OutMail = Nothing
     Set OutApp = Nothing
     
    
     
     End Sub
    What I wanted to do was add a link to the 'H:\Folder\Folder' folder location, so that when the email is sent you would be able to click that link to follow it.

    Any help would be excellent!


    I figured it out now so dont worry!


    If anyone is interested though I Changed my code to this.

    Sub Send()
    Dim OutApp As Object
     Dim OutMail As Object
     
    Call SaveFile
     
     Set OutApp = CreateObject("Outlook.Application")
     OutApp.Session.Logon
     Set OutMail = OutApp.CreateItem(0)
     strbody = "<HTML><BODY>"
        strbody = strbody & "<A href=J:\Projects\Folder%20Name>New User Requirements</A>"
        strbody = strbody & "</BODY></HTML>"
    
     On Error Resume Next
     With OutMail
     .To = "will.norris@email.org"
     .Subject = "New User Requirements"
     .HTMLBody = "A new users requirements form has been submitted for " & Range("D5") & " to be set up for the start date of " & Range("D9") & " The form is held in " & strbody
    
    .Send
    
     End With
     On Error GoTo 0
    
     Set OutMail = Nothing
     Set OutApp = Nothing
     
    
     
     End Sub
    Last edited by Will_iam; 12-03-2012 at 10:15 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hyperlink text that displays in email through VBA code

    Thank you for providing the solution. Though next time onwards, please post the solution as a separate post, so its easy to distinguish between the question and the answer.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1