Hello I am having a problem with this code:
Sub AutomateIE()
Dim ie As InternetExplorer
Dim RegEx As RegExp, RegMatch As MatchCollection
Dim MyStr As String
Set ie = New InternetExplorer
Set RegEx = New RegExp
'Search google for "vbax kb"
ie.Navigate "http://www.google.com.au/search?hl=en&q=vbax+kb&meta="
'Loop unitl ie page is fully loaded
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
'String to parse google search for a VBAX reference
With RegEx
.Pattern = "www.vbaexpress.+?html"
.MultiLine = True
End With
'return text from google page
MyStr = ie.Document.body.innertext
Set RegMatch = RegEx.Execute(MyStr)
'If a match to our RegExp searchstring is found then launch this page
If RegMatch.Count > 0 Then
ie.Navigate RegMatch(0)
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
MsgBox "Loaded VBAX link"
'show internet explorer
ie.Visible = True
Else
MsgBox "No VBAX link found"
End If
Set RegEx = Nothing
Set ie = Nothing
End Sub
Every time i try to run it comes up with "User-defined type not defined"
Any ideas?
Bookmarks