Solved

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

Posted on 2014-12-23
7
413 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 14

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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 14

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 14

Expert Comment

by:DrTribos
ID: 40515643
Glad to help
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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 …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now