ich habe folgendes Problem:
Folgender Code funktioniert mit IE Es wird immer IE11 geöffnet und erhalte die Fehlermeldung "Die Methode 'Document' für das Objekt 'IWeb2' ist fehlgeschlagen"
ich habe bereits mit Zeitverzögerungen gearbeitet, bis die Webseite vollständig geladen wird. DoEvent, Loop, ReadyState aber nichts klappt.
Hat jemand noch eine Idee?
Besten Dank
Max
Private Sub URL_Load(ByVal sURL As String)
Application.ScreenUpdating = False
Dim appIE As Object
Dim sTxt As String
Set appIE = CreateObject("InternetExplorer.Application")
appIE.navigate sURL
Do: Loop Until appIE.Busy = False
Do: Loop Until appIE.Busy = False
sTxt = appIE.Document.DocumentElement.outerHTML 'Hier kommt die Fehlermeldung
Set appIE = Nothing
Close
Open ThisWorkbook.Path & "\temp.txt" For Output As #1
Print #1, sTxt
Close
Application.ScreenUpdating = True
'MsgBox "Der Text wurde gespeichert unter:" & vbLf & _
ThisWorkbook.Path & "\temp.txt"
End Sub
Sub Quellcodeladen()
Application.ScreenUpdating = False
If MsgBox("Sollen die TU-Daten geladen werden?", vbYesNo) = vbYes Then
Call URL_Load("Link")
End If
Application.ScreenUpdating = True
End Sub