Consulting

Results 1 to 2 of 2

Thread: HTML href cutting off URL at first space

  1. #1
    VBAX Tutor MINCUS1308's Avatar
    Joined
    Jun 2014
    Location
    UNDER MY DESK
    Posts
    254

    HTML href cutting off URL at first space

    I have a sub that sends an email (with an attachment and a link to the file)
    It worked just fine up until last week. (2+ years - without modifying the file)

    'EMAIL BODY
            Dim MailTxt As String
                MailTxt = "<p>Attached is a copy of the updated Report.</p>" & _
                           "<a href=" & ActiveWorkbook.FullName & ">Report</a>"
    Immediately after assigning MailTxt the link is correct.
    The Email is sent but when I click the link in the email - Outlook says it cant open the link.
    The msgbox displays the link up until the first space.

    Example:
    Desired Link: L:\Segment\Region\Company\Department\Daily Reports\My First Report.xlsm
    Link after assignment to MailTxt in VB: L:\Segment\Region\Company\Department\Daily Reports\My First Report.xlsm

    Link sent in email: L:\Segment\Region\Company\Department\Daily

    In testing - I removed the space from 'Daily Reports' an then sent the email and got the following link:
    L:\Segment\Region\Company\Department\DailyReports\My


    I'm not sure what changed, but does anyone have a solution / alternate method of sending he link?
    - I HAVE NO IDEA WHAT I'M DOING

  2. #2
    VBAX Tutor MINCUS1308's Avatar
    Joined
    Jun 2014
    Location
    UNDER MY DESK
    Posts
    254
    I was able to resolve the problem by replacing the spaces in the UNC with "%20"
        'EMAIL BODY
            Dim MailTxt As String
                MailTxt = "<p>Attached is a copy of the updated Report.</p>" & _
                            "<a href=" & Replace(CStr(ActiveWorkbook.FullName), " ", "%20") & "> Report</a>"
    I still don't understand why this stopped working after 2 years?
    - I HAVE NO IDEA WHAT I'M DOING

Posting Permissions

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