I need a help from you all. I am trying to develop a macro where in , I search
for a particular text in web site.
For Ex:
In my excel sheet, in first three rows, A1, A2 and A3 I have
www.yahoo.com
www.rediff.com
www.google.com
I have to find whether the text "mail" exists in the three web sites mentioned
above by using VBA.
I have tried writing the code, but its only working fine for the value present
in the first row and for the other rows, its giving the result same as the first
row.
considering the above Ex. in www.google.com, i dont find any text called
"mail". but it shows as it exists. at the same time I am trying to copy the
result in B column.
Can some one help me in this pleaseeeeee.
I have copied the code below , which I tried, but I was not successful.
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
Do While Not intReadyState = 4
intReadyState = objIE.ReadyState
Loop
If InStr(objIE.document.body.innerhtml, "mail") = 0 Then
Worksheets("sheet1").Range("b" & n).Value = "not exists"
Else
'MsgBox "Text Found"
Worksheets("sheet1").Range("b" & n).Value = "exists”
End If
n = n + 1
Wend
End Sub