+ Reply to Thread
Results 1 to 2 of 2

Need help witl Hyperlink in Email body

Hybrid View

  1. #1
    Registered User
    Join Date
    08-30-2013
    Location
    Brighton
    MS-Off Ver
    Excel 2003
    Posts
    3

    Need help witl Hyperlink in Email body

    Hello everyone,

    I'm having an issue with the hyperlink I'm trying to make.

    The hyperlink is contained in an email created by the macro. The hyper link needs to refer to a file name provided in cell E3.

    I'm having two issues.

    1. The hyperlink is not registering spaces and stops at the first space therefore the file path is not complete (it should be R:\DESIGN\DESIGN TEMPLATE\Special Purchase Request\ but actually it comes out as R:\DESIGN\DESIGN)

    2. How do I refer to the cell to get the filename?

    Sub Print_and_Email()
    'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
    'Working in Office 2000-2013
        Dim OutApp As Object
        Dim OutMail As Object
        Dim strbody As String
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
            strbody = "Hi Rory,<br></br>" & _
                  "<br>A new Special Purchase Request form has been saved in the folder.</br>" & _
                  "<br></br><br></br>Please can you provide a quotation for the items listed." & _
                  "<br></br><br></br><A HREF=file:\\R:\DESIGN\DESIGN TEMPLATE\Special Purchase Request\ & filename>Special Purchase Request link</A>" & _
                  "<br></br><br></br>Thank you" & _
                  "<br></br><br></br>" & Range("C2").Value
    
    
        On Error Resume Next
        With OutMail
            .To = ""
            .CC = ""
            .BCC = ""
            .Subject = "Special Purchase Request - " & Range("E2").Value
            .HTMLBody = strbody & "<br>" & .HTMLBody
            'You can add a file like this
            '.Attachments.Add ("C:\test.txt")
            .Send   'or use .Display
        End With
        On Error GoTo 0
    
        Set OutMail = Nothing
        Set OutApp = Nothing
        
    ' SavePDF Macro
    'Sheets("Request Form").Select
    'ChDir "L:\"
    'ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Range("Data!E1").Value _
    ', Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
    ':=False, OpenAfterPublish:=True
    'Sheets("Data").Select
    
    End Sub

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Need help witl Hyperlink in Email body

    Hello schmick,

    Your HTML syntax is wrong. Try this.
            strBody = "Hi Rory,<br><br>" & _
                  "A new Special Purchase Request form has been saved in the folder.<br>" & _
                  "Please can you provide a quotation for the items listed.<br><br>" & _
                  "<A HREF=""file:\\R:\DESIGN\DESIGN TEMPLATE\Special Purchase Request\" & Filename & """>" & "Special Purchase Request link</A>" & _
                  "<br><br>Thank you,<br>" & Range("C2").Value
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Email Hyperlink Adding Body/Subject Text
    By jpmorgan123 in forum Excel General
    Replies: 1
    Last Post: 05-12-2013, 12:41 PM
  2. [SOLVED] Active Hyperlink in Email body.
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2012, 03:25 AM
  3. [SOLVED] Auto Subject & Body email hyperlink ?
    By mitelkm in forum Excel General
    Replies: 4
    Last Post: 10-17-2012, 05:47 AM
  4. Add hyperlink to body of email thru Excel
    By MAYDAY in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2005, 05:05 PM
  5. Insert Hyperlink in body of email
    By MAYDAY in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-04-2005, 12:15 PM

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