chacanger
02-12-2011, 03:02 PM
Hi
I have recently been trying to automate a few processes with IE using Excel VBA. I wondered how can you search for a specific word in a website, I know how to do the rest of the automation but for example if I want to search for a piece of text on Google that says VBAX Original Green and tells me in a MsgBox if it has found it or not.
Here is my test code...
References used: Microsoft Internet Controls Enabled
Sub Search_Text()
Dim ie As InternetExplorer
Set ie = New InternetExplorer
' hide the mouse
ie.Navigate "http://www.google.co.uk/"
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
ie.Visible = True
'||||||||THIS IS WERE THE TEXT SHOULD BE SEARCHED|||||||||
MsgBox "The text has been found!", vbOKOnly, "Message"
Else
MsgBox "No text found!", vbOKOnly, "Message"
End If
End Sub
Thanks
I have recently been trying to automate a few processes with IE using Excel VBA. I wondered how can you search for a specific word in a website, I know how to do the rest of the automation but for example if I want to search for a piece of text on Google that says VBAX Original Green and tells me in a MsgBox if it has found it or not.
Here is my test code...
References used: Microsoft Internet Controls Enabled
Sub Search_Text()
Dim ie As InternetExplorer
Set ie = New InternetExplorer
' hide the mouse
ie.Navigate "http://www.google.co.uk/"
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
ie.Visible = True
'||||||||THIS IS WERE THE TEXT SHOULD BE SEARCHED|||||||||
MsgBox "The text has been found!", vbOKOnly, "Message"
Else
MsgBox "No text found!", vbOKOnly, "Message"
End If
End Sub
Thanks