Skip to content

Instantly share code, notes, and snippets.

@KentaroAOKI
Created August 24, 2015 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KentaroAOKI/b66663c33423dba9d9cb to your computer and use it in GitHub Desktop.
Save KentaroAOKI/b66663c33423dba9d9cb to your computer and use it in GitHub Desktop.
Private Sub ExtractResponseBody(Response As String)
'This procedure parses the response and writes down the result
On Error GoTo ErrorsHandler
Dim Results As Variant
Dim InnerResults As Variant
Response = Replace(Response, "[[", Chr(9))
Response = Replace(Response, Chr(34), "")
Response = Replace(Response, "{", "")
Response = Replace(Response, "}", "")
Response = Replace(Response, "[", "")
Response = Replace(Response, "]", "")
Results = Split(Response, Chr(9))
If UBound(Results) = 1 Then
InnerResults = Split(Results(1), ",")
For Counter = 0 To UBound(InnerResults)
Range("A1").Offset(activeCellRow - 1, inputParamsNumber + Counter + 1).Value = InnerResults(Counter)
Range("A1").Offset(activeCellRow - 1, inputParamsNumber + Counter + 1).Interior.ColorIndex = 15
Range("A1").Offset(activeCellRow - 1, inputParamsNumber + Counter + 1).Font.Name = "Segoe UI"
Next Counter
End If
ErrorsHandler:
If Err.Number <> 0 Then
MsgBox "ExtractResponseBody: " & Err.Description
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment