Forum

Inserting a hyperli...
 
Notifications
Clear all

Inserting a hyperlink into outlook , hyperlink needs to be the path of the excel spreadsheet

5 Posts
2 Users
0 Reactions
69 Views
(@riggerman)
Posts: 11
Active Member
Topic starter
 

Hi 

 

This is a follow on from a previous question, I have a piece of code that once a button is pressed sends an email to recipients with a hyperlink in the body of the mail which takes them to that excel document

 

So the bit I am having trouble with is the following code

 

mbody = "Hello" & vbNewLine & _
"We have a new MDF Brief In, The Project Leaders Section is complete" & vbNewLine & _
"NPD is first in the flow so please complete your section" & vbNewLine & _
"You can access the File here" & """< https://gbconnect.sharepoint.com/sites/BUKGBGATEPROCESS/MDF/MAIDSTONE COMPLETED MDF FORMS 2021/""" & ActiveWorkbook.Name

simply the ActiveWorkbook.name (The filename of the spreadsheet) is not included in the hyperlink and it needs to be

 

Can somebody help me with this please

 

Thank you in advance

 
Posted : 31/07/2021 3:23 am
(@catalinb)
Posts: 1937
Member Admin
 

A link in html looks like this:

 

&lt;a href="https://www.site.com/"&gt;click here&lt;/a&gt;

"You can access the File here: " &amp; "&lt;a href=""https://gbconnect.sharepoint.com/sites/BUKGBGATEPROCESS/MDF/MAIDSTONE COMPLETED MDF FORMS 2021/" &amp; ActiveWorkbook.Name &amp; """" &amp; "&gt;ActiveWorkbook.Name&lt;/a&gt;"

Replace &amp; with &

Replace &gt; with >

Replace &lt; with <

1-3.jpg

 
Posted : 31/07/2021 6:22 am
(@riggerman)
Posts: 11
Active Member
Topic starter
 

Hi Catalin,

 

Thank you for your response. Now the code looks like this :-

"You can access the File here: " & " <a href=""https://gbconnect.sharepoint.com/sites/BUKGBGATEPROCESS/MDF/MAIDSTONE COMPLETED MDF FORMS 2021/" & ActiveWorkbook.Name & """" & ">" & ActiveWorkbook.Name & "</a>"

 

And the outlook looks like this:-

Hello
We have a new MDF Brief In, The Project Leaders Section is complete
NPD is first in the flow so please complete your section
You can access the File here:  <a href=" https://gbconnect.sharepoint.com/sites/BUKGBGATEPROCESS/MDF/MAIDSTONE COMPLETED MDF FORMS 2021/MDF MASTER FORM - MAIDSTONE V20.xlsm">MDF MASTER FORM - MAIDSTONE V20.xlsm</a>

So only some of the hyperlink worked and we have the coding in amongst the hyperlink
 
 
As you can see, unfortunately that did not work. To be honest I had tried the a href, without success prior.

 

This is giving me a real headache, any other solutions / Comments

 

Thank you so much

 

Kind Regards

 

Richard 

 
Posted : 31/07/2021 7:16 am
(@catalinb)
Posts: 1937
Member Admin
 

You are not providing the code you are using so it's hard to see what you are doing.
Are you using .HTMLBody?

If you use .Body instead of .HTMLBody, this will not work.

 
Posted : 31/07/2021 11:03 am
(@riggerman)
Posts: 11
Active Member
Topic starter
 

Hi Catalin,

 

I was using .body not .htmlbody, the link appears in the email perfectly now, however when I tried to open the file from the  email, it opens ok right up until I click "edit workbook" , then  I got an error "unknown error trying to lock file", which after sending to several people turned out to be because it was opening the file in IE instead of Chrome (Useful tip for others there!), anyway it all works perfectly now.

Thank you very much for your help 

Kind Regards

 

Richard

 
Posted : 03/08/2021 2:07 am
Share: