title: Selecting value from a dropdown list on a webpage using vba
body: <p>On <a href="https://visa.kdmid.ru/PetitionChoice.aspx" rel="nofollow noreferrer">this site</a> I am able to select the country and language from dropdown menu but when I click on "Complete new application form" button. It says fields are empty.</p>
  
  <p>Any help would be appreciated.</p>
  
  <pre><code>Sub Test()
  
  strURL = "https://visa.kdmid.ru/PetitionChoice.aspx"
  
    With ie
      .Visible = True
      .navigate strURL
  
      While .Busy
          DoEvents
      Wend
  
      Set html = .document
  
      'Country where you will apply for visa.
      Set ctY = html.getElementById("ctl00$phBody$Country")
      For i = 1 To ctY.Options.Length
          If ctY.Options(i).Text = "NETHERLANDS" Then
              ctY.selectedIndex = i
              Exit For
          End If
      Next i
  
      'Select Language
      Set lnG = html.getElementById("ctl00$phBody$ddlLanguage")
      For i = 1 To lnG.Options.Length
          If lnG.Options(i).Text = "ENGLISH" Then
              lnG.selectedIndex = i
              Exit For
          End If
      Next i
  
      'Click I have read instructions check box
      html.getElementById("ctl00$phBody$cbConfirm").Click
  
  
      'Click apply button
      Set btnGo = html.forms(0).all("ctl00$phBody$btnNewApplication") 
      btnGo.Click
  
    End With
  
    End Sub
  </code></pre>