Select a value from a drop down list on the web (HTML) with VBA

Juan Fonseca

New Member
Joined
Apr 4, 2021
Messages
3
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Platform
  1. Windows
  2. Web
Kind regards, I am trying to automate a process to upload information from an excel to a web page.

I have already managed to upload all the information looking for the IDs, Classes, Tag, Names as appropriate (searching the page for each section and using .getElementById, .getElementsByTagName, .getElementsByName, etc ... (this part is clear to me)) , but I get to the drop-down list and I don't know how to select one of its options.

1617555208529.png

Specifically, I want to change that option "Vigente" to "Terminado".


I appreciate who can guide me, thank you very much for your attention.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

lrobbo314

Well-known Member
Joined
Jul 14, 2008
Messages
3,155
Office Version
  1. 365
Platform
  1. Windows
Something like this.

VBA Code:
Sub TestDD()
Dim IE As Object: Set IE = CreateObject("InternetExplorer.Application")
Dim dd As Object

With IE
    .navigate "https://www.seleniumeasy.com/test/basic-select-dropdown-demo.html"
    Set dd = .document.getelementbyID("select-demo")
    Debug.Print dd.Children(1).innertext
End With
End Sub
 

Juan Fonseca

New Member
Joined
Apr 4, 2021
Messages
3
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Platform
  1. Windows
  2. Web
Your answer was according to my undertanding of the web scrapping knowlage, don't worry, it wasn't neccesary a code example.

Thanks, for your help. This "Children" option apply if i have a class or a tag instead of the ID?.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,310
Messages
5,641,450
Members
417,210
Latest member
rins

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top