vielleicht kann mir jemand helfen. Ich möchte gern die im beigefügtem VBA-Code stehenden Web-Adresse variabel in einer Excelzelle z.B. C2 verändern können. Also die URL sollte nicht im VBA-Code feststehen sondern variabel über die Excelzelle ausgetauscht werden können.
Geht das überhaupt?
Danke für die Hilfe.
Sub Abfrage()
Dim txt As String, strSearch As String
strSearch = "Diese"
txt = LoadURL("http://www.excel-cd.de/main_main.htm")
If InStr(txt, strSearch) Then
Range("A1") = "Das Wort " & strSearch & _
" wurde gefunden"
Else
Range("A1") = "Das Wort " & strSearch & _
" wurde nicht gefunden"
End If
End Sub
Function LoadURL(URL As String) As String
Dim IEApp As Object
Dim IEDocument As Object
Set IEApp = CreateObject("InternetExplorer.Application")
IEApp.Visible = False
IEApp.Navigate URL
Do: Loop Until IEApp.Busy = False
Do: Loop Until IEApp.Busy = False
Set IEDocument = IEApp.Document
LoadURL = IEDocument.Body.innerText
IEApp.Quit
Set IEDocument = Nothing
Set IEApp = Nothing
End Function