Consulting

Results 1 to 2 of 2

Thread: Navigate web pages until search complete

  1. #1
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location

    Navigate web pages until search complete

    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!

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •