AW: Excel Explorer TAG Fenster auslesen
22.03.2009 17:33:40
Tino
Hallo,
habe Dir mal ein einfaches Beispiel aufgebaut.
So einfach ist es aber doch nicht,
weil wir hier einen Html Code haben und wir uns die notwendigen Daten raus filtern müssen.
Bei VBA nur mit Recorder, wird es etwas schwierig werden.
Dim objMatch As Object
Sub WebDatenFiltern(strBody As String)
Dim objRegEx As Object
Set objRegEx = CreateObject("VBScript.RegExp")
With objRegEx
.MultiLine = True
.Global = True
.IgnoreCase = True
.Pattern = "content>.*?<"
Set objMatch = .Execute(strBody)
End With
Set objRegEx = Nothing
End Sub
Sub WebseiteAusfüllen()
Dim appIE As Object
Dim strBody As String
Dim A As Long, lCount As Long
Set appIE = CreateObject("InternetExplorer.application")
appIE.Visible = False
appIE.Navigate "http://www.herber.de/cgi-bin/tag1.pl"
While Not appIE.ReadyState = 4 'Warte auf Webseite
DoEvents
Wend
WebDatenFiltern appIE.Document.Body.InnerHtml
appIE.Quit
Columns(1).Value = ""
Columns(1).NumberFormat = "@"
For A = 0 To objMatch.Count - 1
strBody = Replace(objMatch(A), "content>", "")
strBody = Replace(strBody, "<", "")
If strBody <> "" Then
lCount = lCount + 1
Cells(lCount, 1) = strBody
End If
Next A
Set appIE = Nothing: Set objMatch = Nothing
End Sub
Gruß Tino