I have a web form that I want to fill out automatically using VBA. The code below works fine with all text elements in the form but unable to set a value in the combobox of the form (Error 438 is being returned). By inspecting HTML code, I can see that the object does not have any values.
Object details from HTML
<span title="Choose Currency" class="select2-selection__rendered" id="select2-currency-container">Choose Currency</span>
Option Explicit
Sub WebFormDataEntry()
Dim IE As Object
Dim doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://webaddress"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
'Set intellisense.
Set doc = IE.document
With doc
.getElementById("amount").Value = 9.99
.getElementById("iban").Value = "GB7911111111111"
.getElementById("beneficiaryName").Value = "John Smith"
.getElementById("beneficiaryCity").Value = "London"
.getElementById("beneficiaryAddress").Value = "16 Baker's street"
.getElementById("paymentDetails").Value = "inv 4444"
.getElementById("swift").Value = "BRCLGBLO"
.getElementById("beneficiaryBank").Value = "Barcly's bank"
.getElementById("beneficiaryBankAddress").Value = "101 Big Ben street"
'UP TO THIS POINT ALL WORKS FINE!
'This one returns Error 438. In HTML code this object does not have any values.
.getElementById("select2-currency-container").Value = "EUR"
End With
End Sub