+ Reply to Thread
Results 1 to 8 of 8

Hyperlinking part of an email body

Hybrid View

  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question Hyperlinking part of an email body

    Hi All,

    I'm am creating an auto e-mail that is send from excel but i need to hyperlink part of the email body

    Here's what i have so far:

    Public Sub SendEmailToDave(ID As String, Action As String)
    Dim MailSelection As Object
    Dim Subject As String
    Dim EmailAddress As String
    Dim StrKID As String
    Dim ToDo As String
    Dim Href As String
    
    Href = "http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=" & ID
    
    StrKID = Application.UserName
    
    Select Case Action
        Case 1
            ToDo = "Open"
        Case 2
            ToDo = "Close"
    End Select
        
        Set OutLookApp = CreateObject("Outlook.Application")
         
                Subject = "Quiggers - Actions Required"
                EmailAddress = StrKID
                 
                Set MailSelection = OutLookApp.CreateItem(0)
                With MailSelection
                    .to = EmailAddress
                    .Subject = Subject
                    .Body = " Please could you " & ToDo & " & ARNIE Report " & ID & vbCr & vbCr _
                          & Href & vbCr & vbCr _
                          & " Thank you "
                    .display
                    SendKeys "%{S}", True
                End With
    End Sub
    Where i add the "Href" it does show the lilnk but instead of the entire link i just want it to be the "ID" (A 5 digit number so use 12345 as an example"

    i hop that's clear people and any help is greatly appreciated.

    Cheers
    Last edited by Macdave_19; 09-16-2010 at 08:43 AM.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Hyperlinking part of an email body

    I think you would need to revert to .HTMLBody and use HTML mark up accordingly, in pseudo-terms - creating the tag:

    Href = "<a>http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=" & ID & ">" & ID & "</a>"

  3. #3
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question Re: Hyperlinking part of an email body

    Hi DonkeyOte

    So i've changed it as follows:

    Public Sub SendEmailToDave(ID As String, Action As String)
    Dim MailSelection As Object
    Dim Subject As String
    Dim EmailAddress As String
    Dim StrKID As String
    Dim ToDo As String
    Dim Href As String
    
    Href = "<a>http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=" & ID & ">" & ID & "</a>"
    
    StrKID = Application.UserName
    
    
        
        Set OutLookApp = CreateObject("Outlook.Application")
         
                Subject = "Quiggers - Actions Required"
                EmailAddress = StrKID
                 
                Set MailSelection = OutLookApp.CreateItem(0)
                With MailSelection
                    .to = EmailAddress
                    .Subject = Subject
                    .Body = " Please could you " & Action & " ARNIE Report " & ID & vbCr & vbCr _
                          & Href & vbCr & vbCr _
                          & " Thank you "
                    .display
                    SendKeys "%{S}", True
                End With
    End Sub
    And i still get this in the mail:

    Please could you Open ARNIE Report 64999

    <a>http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=64999>64999</a>

    Thank you

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Hyperlinking part of an email body

    As DO said, you need to use .HTMLBody, not .Body
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Question Re: Hyperlinking part of an email body

    Nop luck lads:

    Public Sub SendEmailToDave(ID As String, Action As String)
    Dim MailSelection As Object
    Dim Subject As String
    Dim EmailAddress As String
    Dim StrKID As String
    Dim ToDo As String
    Dim Href As String
    
    StrKID = Application.UserName
    
    
        
        Set OutLookApp = CreateObject("Outlook.Application")
         
                Subject = "Quiggers - Actions Required"
                EmailAddress = StrKID
                 
                Set MailSelection = OutLookApp.CreateItem(0)
                With MailSelection
                    .to = EmailAddress
                    .Subject = Subject
                    .HTMLBody = " Please could you " & Action & " ARNIE Report " & ID & vbCr & vbCr _
                          & "<a>http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=" & ID & ">" & ID & "</a>" & vbCr & vbCr _
                          & " Thank you "
                    .display
                    SendKeys "%{S}", True
                End With
    End Sub
    and i still get:

    Please could you Open ARNIE Report 64999 http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=64999>64999 Thank you

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Hyperlinking part of an email body

    I blatantly paid no attention to the code I posted...

    "<a href=http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=" & ID & ">" & ID & "</a>"

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Hyperlinking part of an email body

    Try:
    Public Sub SendEmailToDave(ID As String, Action As String)
    Dim MailSelection As Object
    Dim Subject As String
    Dim EmailAddress As String
    Dim StrKID As String
    Dim ToDo As String
    Dim Href As String
    
    StrKID = Application.UserName
    
    
        
        Set OutLookApp = CreateObject("Outlook.Application")
         
                Subject = "Quiggers - Actions Required"
                EmailAddress = StrKID
                 
                Set MailSelection = OutLookApp.CreateItem(0)
                With MailSelection
                    .to = EmailAddress
                    .Subject = Subject
                    .HTMLBody = " Please could you " & Action & " ARNIE Report " & ID & "<BR><BR>" _
                          & "<a href=http://corshwdsslv02.corp.pg.eon.net/Arnie/ViewReport.aspx?reportid=" & ID & ">" & ID & "</a>" & "<BR><BR>" _
                          & " Thank you "
                    .display
                    SendKeys "%{S}", True
                End With
    End Sub

  8. #8
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Thumbs up Re: Hyperlinking part of an email body

    Cracking Stuff fellas!

    it;s almost like you know what you're doing lol

    Nice one, as ever you've both been awesome!

+ 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