+ Reply to Thread
Results 1 to 2 of 2

VBA and Website Input and Search

Hybrid 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.

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

    Re: VBA and Website Input and Search

    After much digging and asking around, I have found that the problem with the way the website is setup. The textbox that I want to populate is editable but because the author of the website made it "hidden" I can't see the value that vba is inputting. It's there and when I click the search button, it gets searched but I just can't see the value. I have read that the reason I can see it when I type it in manually is because it uses JavaScript and that's what triggers the "visible" text to appear. In all cases, I am satisfied and will move on.

+ Reply to Thread

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