VBA and HTML - change a combobox

Asked

Viewed 65 times

0

I need a VBA programming that:

  1. Enter the website http://www.bmfbovespa.com.br/shared/iframe.aspx?altura=400&idioma=pt-br&url=http://www.bmfbovespa.com.br/pt/markets/stocks/quotes/newsletter/journal.Asp

  2. Change the combobox according to cell B2 value of the spreadsheet

  3. Refresh the page

I am using the code below, but without success.


Public ie As InternetExplorer
Dim objCollection As Object
Dim element As IHTMLElement
Dim elements As IHTMLElementCollection    

Public Sub internet()
Workbooks("Copy of teste.xlsm").Worksheets("Plan1").Select

dia = ActiveSheet.Cells(2, 2)

Set ie = New InternetExplorerMedium

ie.Visible = True
ie.navigate "http://www.bmfbovespa.com.br/shared/iframe.aspx?altura=400&idioma=pt-br&url=http://www.bmfbovespa.com.br/pt-br/mercados/acoes/cotacoes/boletim-diario/BoletimDiario.asp"

Call IEWait(ie)

ie.document.getElementsByName("cboData")(0).Value = dia


End Sub
  • What happens when you run this code? Any errors? Otherwise, you can play Document content to a cell and analyze?

  • In the last line, error appears:

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.