Consulting

Results 1 to 3 of 3

Thread: VBA code to initiate search button on website

  1. #1

    VBA code to initiate search button on website

    Hi,

    I'm trying to write a VBA program to go to a property website, insert an address, look up the result and return values to excel. I've been able to successfully navigate to the website and input the property address but I can't work out the ID for the search button so that it will look up details on the property address. I was therefore hoping that someone could help.

    The website address is the search function on the onthehouse website. A picture (although small) is shown below. On the right there are two buttons, a reset button and a search button. I want to click on the search button
    Onthehouse.jpg

    The HTML code associated with these buttons as far as I can tell is:
    tdclass="search-buttons"colspan="2"><buttonclass="btn btn-primary pull-right">Search</button><buttonclass="btn btn-secondary pull-right"id=reset-buttontype=resetvalue=Reset>Reset</button></td>
    </tr>
    </table>

    My VBA code to click the button is:
    .document.getElementById("???").Click

    However I don't know what to put in the ??? as I can't find the ID for the Search button I can only find it for the reset button. I would appreciate if someone could tell me what to replace the ?? with or alternatively show me some other VBA code to click the button.

    Thanks,
    Kieran

  2. #2
    VBAX Expert
    Joined
    Oct 2012
    Posts
    726
    Location
    submit the form?

    browser.document.forms("search-form").submit

  3. #3
    Thanks John,

    The syntax you provided didn't quite work as is but after tinkering with it and using .Document.forms(1).submit I got it to work. Thanks for your help.

    Cheers,
    Kieran

Tags for this Thread

Posting Permissions

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