Solved

How do I make a hyperlink that includes spaces in email VBA code?

Posted on 2014-12-23
7
473 Views
Last Modified: 2015-01-28
I really have two questions (but #2 is predicated on #1 working):
1)  The code below shows the body of an email with a hyperlink to a path which has spaces in it.  The code works fine to a directory path without spaces.  When it reaches a space however, the code doesn't notice any part of the path beyond the space.
2)  Since I haven't gotten beyond #1 above, I just want to make sure I can use variants within the path to further identify the directory.
>>>>> How do I get beyond #1 question so a space is acceptable to VBA in this hyperlink?

Dim InvPer As String
Dim NewRef3 As String
NewRef3 = Format(Date(), "yyyy")
InvPer = Format(Date(), "mm.yy")
 
.HTMLBody = "Mary,   " & "<BR>" & "<BR>" & _
            "The " & Chr(34) & "<I>" & "Trial Balance.xlsx" & "</I>" & Chr(34) & " file in the " & _
        '"<a href=\\carefirst.com\corp\shared\Finance\Finance Shared\Beeline\Invoices>" & _
            "S:\Finance\Finance Shared\Beeline\Invoices\" & NewRef3 & "\" & InvPer & "\" & "</a>" & _
            " directory has been updated.  " & "<BR>" & "<BR>" & _
            "Please notify if I can be of further assistance. " & "<BR>" & "<BR>" & _
            "Thanks. "
0
Comment
Question by:CFMI
  • 3
  • 3
7 Comments
 
LVL 5

Assisted Solution

by:Hakan Yılmaz
Hakan Yılmaz earned 250 total points
ID: 40515620
Try
vbNewLine or vbCrLf
0
 
LVL 15

Assisted Solution

by:DrTribos
DrTribos earned 250 total points
ID: 40515622
Use %20 instead of space
0
 
LVL 5

Expert Comment

by:Hakan Yılmaz
ID: 40515627
Ah, i tought you mean newlines.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 15

Accepted Solution

by:
DrTribos earned 250 total points
ID: 40515628
Using variable should be ok to build the path
0
 
LVL 5

Assisted Solution

by:Hakan Yılmaz
Hakan Yılmaz earned 250 total points
ID: 40515630
You can use double quotes as escape character in string.
So you can make it like HTMLBody="<a href=""this is my href with spaces"">this is my hyperlink</a>"
0
 
LVL 1

Author Closing Comment

by:CFMI
ID: 40515640
You guys are sooo on the ball.  . . . . SO FAST that my question was answered AND CORRECT almost before I asked!!!

THANK YOU.  Happy Holidays.
0
 
LVL 15

Expert Comment

by:DrTribos
ID: 40515643
Glad to help
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question