0

I have written a VBA code which sends an http request and will get a response from the provided URL. The .responsetext then will copied to my userform textbox control. The only problem is that it is in linear format. I want it to be regular HTML format (Breaked into multiple lines. Each Tag in a seperate line). How Can I achieve this? Is there a pre-written function for that?

My code so far:

Private Sub CommandButton1_Click() 'Login

Dim Req As New WinHttpRequest

Req.Open "Get", TextBox1, False
Req.Send

TextBox4.Text = Req.ResponseText

End Sub
Milad
  • 77
  • 11
  • 1
    There is no requirement in html for line breaks. Search and replace `">"` with `">" & vbcrlf`. – KL-1 Jan 19 '22 at 07:24
  • @KL-1 I have tried to modify .ResponseText with Replace(Req.ResponseText, ">", ">" & vbCrLf) function but the displaying text in the TextBox shows a breakline character instead of actually showing tags in seperate lines. – Milad Jan 19 '22 at 07:36
  • 1
    Is your textbox set to multi-line? What happens if you just do this `TextBox4.Text ="Line 1" & vbLf & "Line 2"` – Tim Williams Jan 19 '22 at 08:19
  • @TimWilliams No. Thanks. That was the problem. – Milad Jan 19 '22 at 08:20

0 Answers0