Solved

Hyperlink With Spaces In Visual Basic

Posted on 2011-09-06
4
202 Views
Last Modified: 2012-05-12
I have some code that saves a file to a location based on a path the user selects. I have the location of that saved location stored in a string called findShare, I go to put that location in the footer of a message and if it contacts a space in it the hyperlink will be broken.

I am also using some code that replaces the Network drive name with the unc address of the item. If I can get a hyperlink with the network drive name that will be a plus but I am more worried about just getting a full hyperlink so they can click it and go directly to it.

Thanks in advance.

 File Name With Space File Name Without Space
Dim findShare As String

findShare = theFolderBrowser.SelectedPath & "\" & myAttachments(i).DisplayName()

findShare = findShare.Replace("G:", "\\Server\Share1")

myItem.htmlBody = myItem.htmlBody & _
"<br>File: " & findShare & vbCrLf

Open in new window

0
Comment
Question by:Tectonic
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
WalkaboutTigger earned 500 total points
ID: 36491797
Remember what a hyperlink is - an anchor with a text description.

Dim findShare, findShareHTML as String

findShareHTML = findShare.Replace(" ", "%20")
myItem.htmlBody = myItem.htmlBody & _
"<br>File: " & "<a href=" & Chr(34) & findShareHTML & Chr(34) & ">" & findShare & "</a>" & vbCrLf

I don't have my development machine here to try it, but give it a shot.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36491803
replace
space

Open in new window

by %20

.Replace(" ","%20")

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 36491819
0
 

Author Closing Comment

by:Tectonic
ID: 36491851
That is exactly what I was missing. I was looking high and low for that somewhere on the web but couldn't find it. I knew I had to do something with the %20 but didn't know how to get it in there.

It worked perfectly adding it to the code.

Thanks.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio hangs on running project 6 62
User Account issue 6 43
exchange 13 25
Email question 12 23
What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

730 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