SlinkyWheels
Board Regular
- Joined
- Jan 5, 2007
- Messages
- 217
Hi
I am using the following code in Excel 2003 to add a hyperlink into an email.
Public Sub email()
Dim fname As String
Set ol = CreateObject("Outlook.application")
Set NewMessage = ol.CreateItem(olMailItem)
fname = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With NewMessage
.to = "someone@soomewhere.co.uk"
.Subject = "This is only a test!"
'Insert body and Hyperlink below...
.Body = "file://" & fname
.Display
End With
Set ol = Nothing
Set NewMessage = Nothing
End Sub
The problem I have is that the file path contains a space so when this is added to the body of the email, the hyperlink I am trying to create stops at the space in the file path.
I have read I need to do something with "%20" but I am not sure what?
Can anyone shed any light on this for me?
I am using the following code in Excel 2003 to add a hyperlink into an email.
Public Sub email()
Dim fname As String
Set ol = CreateObject("Outlook.application")
Set NewMessage = ol.CreateItem(olMailItem)
fname = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With NewMessage
.to = "someone@soomewhere.co.uk"
.Subject = "This is only a test!"
'Insert body and Hyperlink below...
.Body = "file://" & fname
.Display
End With
Set ol = Nothing
Set NewMessage = Nothing
End Sub
The problem I have is that the file path contains a space so when this is added to the body of the email, the hyperlink I am trying to create stops at the space in the file path.
I have read I need to do something with "%20" but I am not sure what?
Can anyone shed any light on this for me?