Results 1 to 2 of 2

VBA and Website Input and Search

Threaded View

  1. #1
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    VBA and Website Input and Search

    Hi,

    Does anyone see how to input the search text into the search form on this webpage?

    Here is what I have so far:

    Set ieApp = CreateObject("InternetExplorer.Application")
      ieApp.Navigate URLSearch
      ieApp.Visible = True
    
      ' Wait till IE refreshed before searching for the next term
        While ieApp.Busy = True: DoEvents: Wend
        Set ieDoc = ieApp.Document
        While ieDoc Is Nothing Or ieDoc.ReadyState <> "complete": DoEvents: Wend
      
        For Each SearchTerm In SearchTerms
          ' Wait till IE refreshed before searching for the next term
            While ieApp.Busy = True: DoEvents: Wend
            Set ieDoc = ieApp.Document
            While ieDoc Is Nothing Or ieDoc.ReadyState <> "complete": DoEvents: Wend
          ' Place search term in search box
            While Inputbox Is Nothing: Set Inputbox = ieDoc.getElementById("searchfield"): Wend
            Inputbox.Value = SearchTerm
          ' Click on the Search button
            While InputBtn Is Nothing: Set InputBtn = ieDoc.all("searchbutton"): Wend
            InputBtn.Click
          ' Wait till IE refreshed before searching for the next term
            While ieApp.Busy: DoEvents: Wend
          ' Reset objects for next web page
            Set ieDoc = Nothing
            Set InputBtn = Nothing
            Set Inputbox = Nothing
        Next SearchTerm
    Exit Sub
    I am attaching a txt file with the html script and a pic with the what the field looks like using FireFox's Inspect option.

    Thanks.

    abousetta
    Attached Images Attached Images
    Attached Files Attached Files
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1