Jeg har også moret mig lidt...
Her er en ny Sub Main, der ikke anvender RegExp !
Det er ikke ligefrem den mest strømlinede kode, men den virker.
Både denne kode OG RegExp er afhængige af, at TV-Guiden ikke ændrer deres layout.
Tak til sjh for tippet med StrConv - den kendte jeg ikke.
Sub Main()
Dim Tid As String
Dim Prog As String
Dim HTML As String
Dim P1() As String
Dim P2() As String
Dim Wk As String
Dim IX As Long
Dim Pos As Long
Const HowMuch = 5 'Number of show to display
Const cTid = "<td class=""now"" height=""25"">" '(.*?)</td>
Const cPrg = "<td align=""left"" valign=""middle"" class=""now"">" '(.*?)</td>"
Const cKnl = "<td class=""now"" align=""center""><img src=""channels/" '(.*?).gif"" align=""middle""></td>"
HTML = GetHTMLBin("
http://www.tvguide.dk/now.php")
HTML = StrConv(HTML, vbUnicode)
Pos = InStr(1, HTML, cTid, vbTextCompare)
If Pos <= 0 Then Exit Sub
Wk = Right(HTML, Len(HTML) - Pos - Len(cTid) + 1)
Pos = InStr(1, Wk, "</table>")
Wk = Left(Wk, Pos - 1)
Wk = Replace(Wk, "</td>", "", , , vbTextCompare)
Wk = Replace(Wk, "<tr>", "", , , vbTextCompare)
Wk = Replace(Wk, "</tr>", "", , , vbTextCompare)
Wk = Replace(Wk, ".gif"" align=""middle"">", "", , , vbTextCompare)
Wk = Replace(Wk, vbLf, "", , , vbTextCompare)
Wk = Replace(Wk, cTid, "<<##>>", , , vbTextCompare)
Wk = Replace(Wk, cPrg, "<<!!>>", , , vbTextCompare)
Wk = Replace(Wk, cKnl, "<<!!>>", , , vbTextCompare)
P1 = Split(Wk, "<<##>>")
For IX = 0 To UBound(P1)
If IX >= HowMuch Then Exit For
P2 = Split(P1(IX), "<<!!>>")
Prog = Prog & _
Trim(P2(2)) & ".:" & vbTab & _
Trim(P2(0)) & ".: " & vbTab & _
Trim(P2(1)) & vbCrLf
Next IX
Prog = "Dansk TV lige nu....:" & vbTab & "...Link her..." & vbCrLf & vbCrLf & "Kanal" & vbTab & "Startet" & vbTab & _
"Program" & vbCrLf & "------------------------------------" & vbCrLf & Prog
Tid = Date
Tid = Tid & " .:. " & Time
Tid = "..::TV-Guide - " & Tid & "::.."
MsgBox Prog, vbInformation + vbOKOnly, Tid
End Sub