PDA

View Full Version : Hyperlinks in a body of a Task



Jayfunk
05-02-2014, 07:09 AM
Hello Guys,

I have a control unit which is based in excel which controls a process, at the start of the process it creates a folder saving out all the tools which we use for it. it also creates a task.

In the task body which is not HTML is a list of procedures and a line which only has the word link on it. i am manually creating a hyperlink of the folder which was created at the moment.


texts = "Hello, " & vbNewLine & vbNewLine & "I have received a request to create a Overview Report for " & Trim(Range("D2").Value) & ". " & vbNewLine & vbNewLine & "Link " & vbNewLine & vbNewLine & "Procedure (complete tasks marked with an X):" & vbNewLine & vbNewLine & _


I am trying to find a code which would make the link into a hyperlink with the filepath as thisworkbook.path

I would be greatful for any help

Jason

GeneralPayne
05-03-2014, 07:28 AM
Hi Jason,

I'm not 100% clear on what you're after, but see if this piece of code helps at all:


Sub Hyperlinker()
For Each cell In Range("A1:A100")
ActiveSheet.Hyperlinks.Add Anchor:=cell, Address:=ThisWorkbook.Path & "\" & cell.Text, TextToDisplay:=cell.Text
Next
End Sub

Good luck

snb
05-03-2014, 09:44 AM
You will have to assign that string to .HTMLbody =" ... "



.HTMLBody = replace("Hello, ~~I have received a request to create an Overview Report for " & Trim(Range("D2").Value) & ". ~~<a href=""G:\OF\example.xlsx"">Link</a>~~Procedure (complete tasks marked with an X):~~" ,"~",vblf)