I am developing a solution and there is a need to add zip code search. In return I would like to get the address based on the informed CEP.
I started writing the code below but I stopped 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 give as a zip code not registered!