Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Willie Howell   on Sep 21 In MS Office Category.

  
Question Answered By: Essie Garza   on Sep 21

Cool possibilities here. I found some things:
1. intReadyState has to be reset for each web  site
2. wait an additional 1 sec after intReadyState = 4
3. use LCase to make it not case sensitive


Sub Main()
Dim objIE As Object
Dim strWebSite As String
Dim intReadyState As Integer
Dim order  As String
Dim n, a, total  As Integer
n = 1
total = Worksheets("sheet1").UsedRange.Rows.Count
Set objIE = CreateObject("InternetExplorer.Application")
While n <= total
strWebSite = Worksheets("sheet1").Range("a" & n).Value
objIE.Visible = 1
objIE.Navigate strWebSite
intReadyState = 0
Do While Not intReadyState = 4
intReadyState = objIE.ReadyState
Loop
'wait an additional 1 second
PauseTime = 1 'seconds
Start = Timer
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop

DocText = objIE.Document.body.innerhtml
DocText = LCase(DocText)
'Call SaveDoc(DocText, "DocText" & n & ".txt")
If InStr(DocText, "mail") = 0 Then
Worksheets("sheet1").Range("b" & n).Value = "not
exists"
Else
Worksheets("sheet1").Range("b" & n).Value = "exists"
End If
n = n + 1
Wend
Set objIE = Nothing
End Sub

Sub SaveDoc(TheDoc, fName)
Path = Application.ThisWorkbook.Path & "\" & fName
fn = FreeFile()
Open Path For Output As fn
Print #fn, TheDoc;
Close #fn
End Sub

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Help required in Web to Excel Or get search suggestion and latest updates.


Tagged: