Gruppe
Extern
Problem
Aus einer HTML-Seite soll der Titel ausgelesen werden.
StandardModule: Modul1
Sub ReadTitle()
Dim iFile As Integer
Dim sFile As String, sTxt As String
Dim bln As Boolean
sFile = Range("B1").Value
If Dir(sFile) = "" Then
Beep
MsgBox "Datei " & sFile & " nicht gefunden!"
Exit Sub
End If
iFile = FreeFile
Open sFile For Input As iFile
Do Until EOF(1)
Line Input #iFile, sTxt
If InStr(UCase(sTxt), "<TITLE>") Then
sTxt = Right(sTxt, Len(sTxt) - 7)
sTxt = Left(sTxt, InStr(UCase(sTxt), "</TITLE>") - 1)
bln = True
Exit Do
End If
Loop
Close iFile
If bln Then
MsgBox sTxt
Else
MsgBox "Keinen Titel gefunden!"
End If
End Sub