I'm trying to convert an Excel, Word, or Numbers hyperlink to HTML <a>
tag.
For example, I have [linkName] and need
<a href='URL'>[linkName]</a>
.
Any ideas? Thank you.
After a hard research I've found an answer that works, in word or excel you can create a new macro and run it later.
To create a macro, go to 'view->macros' create a new one and paste this code:
Sub AddHREF()
' Turn Word hyperlinks into <a href...> HTML tags
Dim i As Integer
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
With ActiveDocument.Hyperlinks(i)
If InStr(1, .Address, "http://www.gaebler.com", 1) Then
.Range = "<a href=""" & Replace(.Address, "http://www.gaebler.com", "") & """>" _
& Replace(Replace(.TextToDisplay, "<strong>", ""), "</strong>", "") & "</a>"
Else
.Range = "<a href=""" & .Address & """ target=""_blank"" rel=""nofollow"">" & _
Replace(Replace(.TextToDisplay, "<strong>", ""), "</strong>", "") & "</a>"
End If
End With
Next i
End Sub
Then just run the macro and the magic appears!