Hi all,
I'm fairly new at writing macros.
My main goal is to be able to import the "keywords" from the source code of a website to excel.
I found the following code which seems to import most of the source code;
Sub Demo()
Dim ie As Object
Dim sWholeFile As String
Dim asLineByLine() As String
Dim lLine As Long
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "http://www.longhead.com/"
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
sWholeFile = ie.Document.body.innerhtml
ie.Quit
Set ie = Nothing
asLineByLine = Split(sWholeFile, vbCrLf)
For lLine = LBound(asLineByLine) To UBound(asLineByLine)
Sheet1.Cells(lLine + 1, 1).Value = asLineByLine(lLine)
Next lLine
End Sub
The main problem with this however is that it doesn't import the part of the source code which normally includes the keywords.
Where in the code is it going wrong??
Many thanks.
I'm fairly new at writing macros.
My main goal is to be able to import the "keywords" from the source code of a website to excel.
I found the following code which seems to import most of the source code;
Sub Demo()
Dim ie As Object
Dim sWholeFile As String
Dim asLineByLine() As String
Dim lLine As Long
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "http://www.longhead.com/"
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
sWholeFile = ie.Document.body.innerhtml
ie.Quit
Set ie = Nothing
asLineByLine = Split(sWholeFile, vbCrLf)
For lLine = LBound(asLineByLine) To UBound(asLineByLine)
Sheet1.Cells(lLine + 1, 1).Value = asLineByLine(lLine)
Next lLine
End Sub
The main problem with this however is that it doesn't import the part of the source code which normally includes the keywords.
Where in the code is it going wrong??
Many thanks.