Thursday, May 29, 2008

Create HTML from a list of links

Sometimes we have a list of links and we like to convert it into HTML. Take the following example. Suppose I have a list of links as -

and I want them not as text but as links. For that I have to
  • Manually type tag for each.
  • I can paste them in MSWord and click enter after each link and MSWord would automatically make them hyperlinks. That works really good.
But what of I have 50 links or more? It becomes a laborious process so I wrote a small VBA script to do the job.
I just paste the list of links in first column of an empty Excel sheet. Then paste the following code in Visual Basic Editor for Excel and run it as a Macro or we can make a command button for it,
whatever procedure suits anyone. After running all one has to do is copy the list of links and paste into Frontpage and save it as a HTML file.

Here's the code.

Sub HREF( )

' Macro to create hyperlinks out of a list of links

'find the last row contining data
rc = Selection.Row

For i = 1 To rc
Cells(i, 1).Select
p = Selection.Value
If p <> "" Then
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
p, TextToDisplay:=p
End If

End Sub

No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...