Hi,
With a forum member help I was able to import some data from a web page using XML as it follows :
Dim xml As XMLHTTP40
Dim sPost As String
Dim abytPostData() As Byte
Dim sResponse As Variant
Application.ScreenUpdating = False
sPost = "i=P&"
sPost = sPost & "gv=n&"
sPost = sPost & "tab=655&"
sPost = sPost & "nivt=0&"
sPost = sPost & "unit=0&"
sPost = sPost & "pov=1&"
sPost = sPost & "orv=2&"
sPost = sPost & "opv=1&"
sPost = sPost & "sev=63&"
sPost = sPost & "opc315=2&"
sPost = sPost & "poc315=1&"
sPost = sPost & "orc315=3&"
sPost = sPost & "sec315=7169&"
sPost = sPost & "ascendente=&"
sPost = sPost & "opp=1&"
sPost = sPost & "pop=1&"
sPost = sPost & "orp=4&"
sPost = sPost & "sep=28953&"
sPost = sPost & "nome=&"
sPost = sPost & "pon=1&"
sPost = sPost & "orn=1&"
sPost = sPost & "qtu1=1&"
sPost = sPost & "opn1=2&"
sPost = sPost & "qtu6=2&"
sPost = sPost & "opn6=0&"
sPost = sPost & "opn7=0&"
sPost = sPost & "qtu7=9&"
sPost = sPost & "proc=1&"
sPost = sPost & "notarodape=&"
sPost = sPost & "arquivo=&"
sPost = sPost & "formato=1&"
sPost = sPost & "modalidade=1&"
sPost = sPost & "email=&"
sPost = sPost & "decm=99&"
sPost = sPost & "cabec=&"
sPost = sPost & "gera= OK "
abytPostData = StrConv(sPost, vbFromUnicode)
Set xml = New XMLHTTP40
With xml
.Open "POST", _
"http://www.sidra.ibge.gov.br/bda/tabela/protabl.asp?z=t&o=1&i=P"
.setRequestHeader "Content-Type", _
"application/x-www-form-urlencoded"
.send abytPostData
On Error Resume Next
sResponse = .responseText
End With
Set xml = Nothing
Debug.Print sResponse
this procedure refers to the web page http://www.sidra.ibge.gov.br/bda/tab...&o=5&i=P&c=655
where you have to choose some options and then be taken to the page with the data.
The problem is that I tried to duplicate the procedure for another page of the same website and I couldnīt get it to work.
The page Iīm having a hard time is :
http://www.sidra.ibge.gov.br/bda/tab...&o=5&i=P&c=656
and I want to choose the option "tudo" on the third listbox.
I would appreciate some help!
Thanks
Bookmarks