- Sub a()
- Dim OutApp As Object, outMail As Object, strFile As String
- Set OutApp = CreateObject("Outlook.Application")
- Set outMail = OutApp.CreateItem(0)
- With outMail
- .To = "xxx"
- .Subject = "xxx"
- .HTMLBody = "<p>xxx</p>" & _
- "<p>Please find this report here...</p>" & _
- "<a href=" & ThisWorkbook.Path & "\Archive\" & ">" & "Report Location" & "</a>"
- End With
- End Sub
the problem: Thisworkbook.Path includes spaces in the path. The Hyperlink that this code generates always cuts off at the first " " (space) that it comes across, anythign to the right of the space is left off of the generated hyperlink, causing an incorrect path when you click on the hyperlink.
For instance, "Z:\workbook path\excelfile.xlsx" would end up being "Z:\workbook" as a hyperlink because everything to the right of the space will be cut off.
How can i solve this problem without eliminating spaces from every path?