I have an excel-sheet with 3 colums:
A B C
Item Description Hyperlink
I export this to a JSON-file and a HTML-file with a table where users can view the items in the JSON-file. This works pretty good for me. Now i'm stuck and don't know how to do my last improvement to this.
I want to have the hyperlink from column C, on the "item" from column A in the HTML-file. To export the HTML-file, I use the following code (which I find somewhere):
Sub Test()
RangeToHtml Range("A2:B100"), "G:\PD\PW\Production webpagefiles\new\Overview_Table.html"
End Sub
Sub RangeToHtml(rng As Range, fileName As String)
Dim resBeg As String
resBeg = "<html><head><title>Overview</title><link rel=""stylesheet"" href=""Overview_Table_css.css"" type=""text/css"" media=""all"" /></head><body><table><tr class=""heading""><td>Item</td><td>Description</td></tr>"
resEnd = "</table></body></html>"
For i = 1 To rng.Rows.Count
'---Rows---
resBeg = resBeg & "<tr>"
For j = 1 To rng.Columns.Count
'---Columns---
resBeg = resBeg & "<td>"
resBeg = resBeg & rng.Cells(i, j).Value
resBeg = resBeg & "</td>"
Next j
resBeg = resBeg & "</tr>"
Next i
Call SaveStringToFile(resBeg & resEnd, fileName)
End Sub
Sub SaveStringToFile(str As String, fileName As String)
Open fileName For Output As #1
Print #1, str
Close #1
End Sub
Could anyone give me a shot in the right direction?