I'm trying to replace a document that I do the download everyday. But I don't know what I need to do after I click the download button. I need to save the document with a specific name in my documents
Dim IE As Object
Dim n, Period1, Period2 As Double
'retorna o internet explorer-return the correct period
Period1 = "201612"
Period2 = "201612"
'abre o internet explorer
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www2.susep.gov.br/menuestatistica/SES/principal.aspx"
IE.Visible = True
Application.Wait (Now + TimeValue("00:00:02"))
'seleciona as operações desejadas
IE.document.getElementById("ctl00_ContentPlaceHolder1_edSelProd").SelectedIndex = "8"
IE.document.getElementById("ctl00_ContentPlaceHolder1_btnConsultar").Click
'seleciona o periodo
Application.Wait (Now + TimeValue("00:00:02"))
Set ieDoc = IE.document
ieDoc.getElementById("ctl00_ContentPlaceHolder1_edInicioPer").Value = Period1
ieDoc.getElementById("ctl00_ContentPlaceHolder1_edFimPer").Value = Period2
'seleciona as empresas
IE.document.getElementById("ctl00_ContentPlaceHolder1_edEmpresas").SelectedIndex = "0"
ieDoc.getElementById("ctl00_ContentPlaceHolder1_Button1").Click
Application.Wait (Now + TimeValue("00:00:02"))
ieDoc.getElementById("ctl00_ContentPlaceHolder1_Button1").Click