Hyperlinks in

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:41 PM GMT

Question

I have anform that contains a hyperlink to a OneNoteNotebook on a SharePoint Site. The hyperlink is added by the user who copies it from OneNote.

Anmacro grabs the hyperlink address and inserts it into anemail. The hyperlink works inand it works if I manually copy it from OneNote tobut when the macro grabs the hyperlink address from thecell and transfers it to Outlook, it doesn't work. The address begins with "onenote:http" which is not recognized byas a link. Is there any way for anmacro to copy the hyperlink from the cell and transfer it with it's formatting to Outlook? If I can do this manually, there must be a way to make this happen with code.


Answer

Try this. If this does not work then I don't know and therefore please try another volunteer.

This will send an email with a link to Yahoo that, when clicked, will open Yahoo.

Set ol = CreateObject("Outlook.application") Set NewMessage = ol.CreateItem(olMailItem)

With NewMessage

   .Recipients.Add "you@somewhere.com"
   .Subject = "This is only a test!"
   
   'Insert body and Hyperlink below...
   .Body = "Please click on the link below..." & vbCrLf & vbCrLf & _
   "http://www.yahoo.com/"
   
   .send

End With

Create a variable to store the location, assumng that is a cell (you did not say) of the address(url)of the hyperlink and you should be able to substitute that variable name for "http://www.yahoo.com/" in the code above.

Advertisement

©2021 eLuminary LLC. All rights reserved.