Hallo,
this is my fist post here, so please apologize if its the wrong group or
topic....
I'm trying to get the source of a HMTL-FIle to read it line by line.
I found a little example that I customized to my requirements, please
find class-definition and program below.
My problem is the routine "title".
As you see it is possible to access the titel of the page
with "objDocument.title" (type is MSHTML.HTMLDocument), and it is
displayed properly.
If I access "body" I get an object, but don't know how to handle.
How do I get the source-code of the page?
I'd like to read the lines into a string-array.
Any suggestions?
Grüße
Werner
------ prog -----------------------
Sub main()
Dim objIEController As clsIEControll
Dim url As String
url = "http://www.Kinderbahn.de"
Set objIEController = New clsIEControll
With objIEController
.LoadDocument url
Do While Not .DocumentComplete
DoEvents
Loop
.title
End With
End Sub
------ class defintion -------------
Option Explicit
Dim WithEvents objIE As InternetExplorer
Dim mDocumentComplete As Boolean
Public Property Get DocumentComplete() As Boolean
DocumentComplete = mDocumentComplete
End Property
Public Sub LoadDocument(strDocumentname As String)
mDocumentComplete = False
objIE.Navigate2 strDocumentname
End Sub
Private Sub Class_Initialize()
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.Silent = True
End Sub
Private Sub Class_Terminate()
Set objIE = Nothing
End Sub
Private Sub objIE_BeforeNavigate2(ByVal pDisp As Object, url As Variant,
Flags As Variant, TargetFrameName As Variant, PostData As Variant,
Headers As Variant, Cancel As Boolean)
mDocumentComplete = False
End Sub
Private Sub objIE_DocumentComplete(ByVal pDisp As Object, url As Variant)
mDocumentComplete = True
End Sub
Public Sub title()
Dim objDocument As MSHTML.HTMLDocument
Set objDocument = objIE.document
MsgBox objDocument.title
Set objDocument = Nothing
End Sub
--
MODELLEISENBAHN FÜR KINDER ==> http://www.kinderbahn.de
THEMA SCHMALSPURBAHN ==> http://www.thema-schmalspurbahn.de
mailto:wf.usenet.nospam.35@werner-falkenbach.de (das kommt schon an)