Hallo,
der Code gereift auf ein HTML table zu. Was könnte hier in folgender Zeile den Laufzeitfehler 91 verursachen:
If Trim(table.Rows(d).Cells(0).innerText) = "Bruttoergebnis vom Umsatz" Then
Gesamte Funktion:
Function ArivaDaten(isin As String, zeile As Long, quellZeile As Long, shA As Worksheet, sh As Worksheet, shVorher As Worksheet, zeileVorher As Long, spOffset As Integer)
Const URL_ANFANG = "https://www.ariva.de/"
Const URL_END = "/bilanz-guv"
'https://www.ariva.de/vonovia-aktie/bilanz-guv
Dim waehrung As String
Dim finanzwert As Boolean
Dim lj As String
Dim gleichesLJ As Boolean
Dim urlTeil As String
Dim url As String
Dim antwort As String
Dim doc As HTMLDocument
Dim tables As IHTMLElementCollection
Dim table As HTMLTable
Dim tabZeile As HTMLTableRow
Dim coll As IHTMLElementCollection
Dim ele As IHTMLElement
Dim datenVorhanden As Boolean
Dim ljGefunden As Boolean
Dim epsGefunden As Boolean
Dim kgvGefunden As Boolean
Dim ekqGefunden As Boolean
Dim umsatzGefunden As Boolean
Dim ebitGefunden As Boolean
Dim ergGefunden As Boolean
Dim ekGefunden As Boolean
Dim Z As Integer
Dim d As Integer
Dim lol As Integer
Dim h As Integer
Dim K As Integer
Dim spalteLJ As Integer
Dim inhalt As String
Dim zahl As Double
Dim V As Variant
Dim ebitStr As String
Dim umsatzStr As String
Dim ergebnisStr As String
Dim eigenkapitalStr As String
Dim BruttoergebnisAJ As Double
Dim BruttoergebnisVJ As Double
Dim umsatz As Double
Dim ergebnis As Double
Dim eigenkapital As Double
Dim spalteAJ As Integer
Dim epsStr As String
Dim ladezeit As String
Dim Details As String
waehrung = shA.Cells(quellZeile, SPALTE_WAEHRUNG).Value
If waehrung = "" Then waehrung = "EUR"
finanzwert = (InStr(CStr(shA.Cells(quellZeile, SPALTE_ART).Value), "F") > 0)
' Call LeereZelle(sh, zeile, SPALTE_LJ)
'Seite aus dem Web abrufen:
urlTeil = shA.Cells(quellZeile, SPALTE_ID_ARIVA).Value
If urlTeil = "" Then
Exit Function
End If
url = URL_ANFANG + urlTeil + URL_END
If Not LadeURLHTTP(url, antwort, True, doc) Then
Call StatusMeldung(zeile, sh, "Lade-F.", url, STATUS_FEHLER)
Else
ladezeit = Format(Now, "dd.mm.yyyy, hh:nn:ss")
Set tables = doc.getElementsByTagName("table")
For Each table In tables
If table.Rows.Length > 0 Then
lol = table.Rows.Length
For d = 1 To lol
If table.Rows(d).Cells.Length > 0 Then
If Trim(table.Rows(d).Cells(0).innerText) = "Bruttoergebnis vom Umsatz" Then
h = table.Rows(d).Cells.Length
If IsNumeric(table.Rows(d).Cells(h).Value) Then
BruttoergebnisAJ = CDbl(table.Rows(d).Cells(h).Value)
BruttoergebnisVJ = CDbl(table.Rows(d).Cells(h - 1).Value)
Else
BruttoergebnisAJ = CDbl(table.Rows(d).Cells(h - 1).Value)
BruttoergebnisVJ = CDbl(table.Rows(d).Cells(h - 2).Value)
End If
datenVorhanden = True
' GoTo BruttoErgebnisGefunden
' GoTo naechsteZeile
Else: datenVorhanden = False
End If
'Set doc = Nothing
'End Function
End If
'naechsteZeile
Next d
End If
Next
'BruttoErgebnisGefunden
sh.Cells(zeile, SPALTE_F_GROSS_E_AJ).Value = BruttoergebnisAJ
sh.Cells(zeile, SPALTE_F_GROSS_E_VJ).Value = BruttoergebnisVJ
End If
Set doc = Nothing
End Function
|