3
I am developing a solution and the need to add the CEP research has arisen. In return I would like to get the address based on the CEP informed. I intend to use this search to fill out an automatic address after informing the ZIP code.
I started writing the code below but stopped at it.
Sub lsPesquisaCEP(ByVal sCEP As String)
On Error GoTo TratarErro
Range("Consulta!a1:H1").Clear
If sCEP <> "" Then
With ActiveWorkbook.XmlMaps("webservicecep_Mapa")
.ShowImportExportValidationErrors = False
.AdjustColumnWidth = True
.PreserveColumnFilter = False
.PreserveNumberFormatting = False
.AppendOnImport = False
End With
ActiveWorkbook.XmlImport URL:= _
"http:/republicavirtual.com.br/web_cep.php?cep=" & sCEP, ImportMap:= _
Nothing, Overwrite:=False, Destination:=Range("Consulta!$a$1")
End If
Calculate
Sair:
Exit Sub
TratarErro:
MsgBox "CEP não cadastrado!"
GoTo Sair
Resume
End Sub
Always gives as unregistered zip code!
Read this question
– danieltakeshi