PDA

View Full Version : Navigate web pages until search complete



clif
05-09-2017, 09:38 PM
Dim wb As Workbook
Dim ws As Worksheet
Dim a As Integer
Dim ie As Object
Set wb = ThisWorkbook
Set ws = wb.Sheets("main")
For a = 2 To 2
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate ws.Cells(1, 2)
While ie.Busy: DoEvents
Wend
Do
Loop Until Not (ie.Busy)
ie.document.all(ws.Cells(2, 2).Value).Value = ws.Cells(a, 1)
ie.document.all(ws.Cells(3, 2).Value).Click
ie.document.all(ws.Cells(4, 2).Value).Click




From above code, will redirect to another webpage.

how to continuse search in the current webpage?







Thisdocument.all(ws.Cells(5, 2).Value).Click

While ie.Busy: DoEvents
Wend
Do
Loop Until Not (ie.Busy)
'ie.Quit
'Set ie = Nothing
Next a

'clean up
'Set ie = Nothing
'Set ws = Nothing
'Set wb = Nothing

'wrdDoc.Close
'wrdApp.Quit
End Sub




Thanks!

mdmackillop
05-10-2017, 01:12 PM
Please read (http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_posthelp_faq_item)