Habe ein Problem mit einer Abfrage von folgender Page:
https://www.e-control.at/konsumenten/service-und-beratung/toolbox/tarifkalkulator?p_p_id=tk_portlet_WAR_tk&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_tk_portlet_WAR_tk__facesViewIdRender=%2FsearchResult.xhtml
Die Abfrage bei: https://www.e-control.at/konsumenten/service-und-beratung/toolbox/tarifkalkulator
funktioniert! Dh PLZ & Kwh Eingabe & Senden
Die nachfolgende Tabelle kann ich zwar abfragen, ist aber leider nicht mein Ziel.
Dort kann man auf die Energielieferanten klicken und die Tabelle die danach kommt würde ich gerne mit meiner Excel Tabelle abgleichen!
Bedeutet in Zelle A:A habe ich die gefragten Abfragefelder eingetragen & in den Spalten daneben hätte ich gerne die Ergebnisse inkl. A:Z 1 & B:Z 2 die Energielieferanten & Produkte.
VBA code: (bisher):
Option Explicit
Sub TableExample()
Dim ws As Worksheet
Dim IE As Object
Dim doc As Object
Dim strURL As String
Dim i As Integer
strURL = "https://www.e-control.at/konsumenten/service-und-beratung/toolbox/tarifkalkulator" _
_
' replace with URL of your choice
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.navigate strURL
Do Until .ReadyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
Application.Wait (Now + TimeValue("0:00:10"))
IE.Document.getElementById("_tk_portlet_WAR_tk_:tk-form-start:tk-index-search- _
_
form-zip").Value = _
Sheets("Tarife e-control config").Range("A1").Value
IE.Document.getElementById("_tk_portlet_WAR_tk_:tk-form-start:tk-index-search- _
_
form-electricity-consumption").Value = _
Sheets("Tarife e-control config").Range("A2").Value
'click the 'go' button
IE.Document.getElementById("_tk_portlet_WAR_tk_:tk-form-start:tk-index-search- _
_
form-search-button").Click
Do Until .ReadyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
Application.Wait (Now + TimeValue("0:00:10"))
Set doc = IE.Document.GetElementsByTagName("table")
Set ws = Sheets("einLink")
FindAllLinks doc, IE
End With
End Sub
Sub FindAllLinks(doc As Object, IE As Object)
Dim ws As Worksheet
Dim dieLinks As Object
Dim einLink As Object
Dim tbl As Object
Dim L As Long
Dim Zeile As Long
Dim tblanz As Long
Set IE = CreateObject("InternetExplorer.application")
Set dieLinks = doc.Item(L).Document.Links
Set ws = Sheets("einLink")
For Each einLink In dieLinks
Zeile = Zeile + 1
'Stop
'Schau dir jetzt im Lokalfenster die Eigenschaften von einLink an.
'Da gibt es so allerhand was du auswerten kannst.
ws.Cells(Zeile, 1) = einLink.href
ws.Cells(Zeile, 2) = "'" & einLink.outerText
Next einLink
GetAllTables doc
'End With
End Sub
Sub GetAllTables(doc As Object)
' get all the tables from a webpage document, doc, and put them in a new worksheet
Dim ws As Worksheet
Dim rng As Range
Dim tbl As Object
Dim rw As Object
Dim cl As Object
Dim tabno As Long
Dim nextrow As Long
Dim i As Long
Dim xl As String
Dim y As Integer
Set ws = Sheets("Stocks")
For Each tbl In doc
tabno = tabno + 1
nextrow = nextrow + 1
Set rng = ws.Range("B" & nextrow)
rng.Offset(, -1) = "Table " & tabno
For Each rw In tbl.Rows
For Each cl In rw.Cells
rng.Value = cl.outerText
Set rng = rng.Offset(, 1)
i = i + 1
Next cl
nextrow = nextrow + 1
Set rng = rng.Offset(1, -i)
i = 0
Next rw
Next tbl
ws.Cells.ClearFormats
End Sub
Hoffe Ihr könnt mir dabei helfen bin schon langsam echt ratlos!!Danke im Voraus!