Excel vba code to select option from drop down box in website

Anonymous
2021-02-21T12:47:52+00:00

Good day

I have created the VBA code process in excel for accessing a website via username and password which works upto a point where it opens an option dropdown box that is defaulted to address.  the other option in the drop down box is  the one i need it to select and start entering the grid coordinates which can be obtained form the spreadsheet.   i am stuck on the code to make it choose "Co-ordinates so i can progress to make it take the coordinates from the spreadsheet. 

Sub Virgin_Click() 'Module8_Virgin

'Call BrowsetoVirgin

Dim MyHTML_Element As IHTMLElement

Dim Myurl As String

Dim HTMLInput As MSHTML.IHTMLElement

Dim HTMLDoc As MSHTML.HTMLDocument

Myurl = "*************"

' irj/portal"

Set MyBrowser = New InternetExplorer

 MyBrowser.Silent = True

 MyBrowser.navigate Myurl

 MyBrowser.Visible = True

 Do

 Loop Until MyBrowser.readyState = READYSTATE_COMPLETE

 Set HTMLDoc = MyBrowser.document

 HTMLDoc.all.ctl00_ContentPlaceHolder1_txtUserName.Value = "Username" 'Enter your email id here

 ' HTMLDoc.all.ctl00_ContentPlaceHolder1_txtPassword.Value = "Password" 'Enter password

 HTMLDoc.all.ctl00_ContentPlaceHolder1_txtPassword.Value = ThisWorkbook.Sheets("Stats").Range("E6").Value 'Enter password

    'Log in button press

    Set HTMLInput = HTMLDoc.getElementById("ctl00_ContentPlaceHolder1_LoginButton")

    HTMLInput.Click

which comes up with 

and i want to choose by selecting it in the dropdown

Can anyone help with this?

Thanks in advance for any help given.

Colin

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2021-02-21T15:51:53+00:00

    Hi

    Perhaps, these videos could guide you

    Regards

    Jeovany

    https://www.youtube.com/watch?v=4ebheN9midA

    https://www.youtube.com/watch?v=7sZRcaaAVbg

    0 comments No comments
  2. Anonymous
    2021-02-21T20:00:02+00:00

    Hi Jeovany, Thanks for this, interesting video, however these only tell me what i have already done by getting the excel vba to log into the website, i am asking about how to select the dropdown box to change the form so i can enter coordinates rather than address.

    So i am still looking i have managed to change the option to coordinates without the click using the line of code below.

    HTMLDoc.getElementById("sidebar_searchtype_select").Value = "location"

    Regards

    Colin

    0 comments No comments