Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2014-12-23
7
Medium Priority
?
760 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 5

Assisted Solution

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

Assisted Solution

by:DrTribos
DrTribos earned 1000 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 15

Accepted Solution

by:
DrTribos earned 1000 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 1000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
New style of hardware planning for Microsoft Exchange server.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

618 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