Kenpachigo
New Member
- Joined
- Feb 17, 2019
- Messages
- 1
Hello everybody,
Usually, I look for solutions on the internet and step by step try to understand what is happening so I can adjust the code to fit my needs. But in this case, I am kinda stuck.
Problem:I want to fill in a web form using VBA code. I can fill in some text fields, select a radio button etc... But the dropdown list is giving me headaches.
I have found some code which seems to (only) highlight the item that I want. But it's only visible when I click on the drop down box. And it seems like that it's not actually clicking/loading that value. When the option is highlighted (by my code), I also cannot click on anything else anymore. Normally, the second drop down box would appear when the first category is selected.
Here is the image on google foto containing HTML code and part of the webform:
https://photos.app.goo.gl/HZLtSyJQB4cApRC87
Usually, I look for solutions on the internet and step by step try to understand what is happening so I can adjust the code to fit my needs. But in this case, I am kinda stuck.
Problem:I want to fill in a web form using VBA code. I can fill in some text fields, select a radio button etc... But the dropdown list is giving me headaches.
I have found some code which seems to (only) highlight the item that I want. But it's only visible when I click on the drop down box. And it seems like that it's not actually clicking/loading that value. When the option is highlighted (by my code), I also cannot click on anything else anymore. Normally, the second drop down box would appear when the first category is selected.
Code:
Sub FillInWebform()
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://www.2dehands.be/plaats/"
Application.StatusBar = "Submitting"
While IE.Busy
DoEvents
Wend
IE.document.getElementById("manual-option").Click 'clicking on the radio button to show the drop down field
Set Title = IE.document.getElementById("level1-option")
Title.selectedIndex = 40
Set Title = IE.document.getElementById("price")
Title.selectedIndex = 1
IE.Quit
Set IE = Nothing
End Sub
Here is the image on google foto containing HTML code and part of the webform:
https://photos.app.goo.gl/HZLtSyJQB4cApRC87