Why does WinHTTPRequest responseText return a different value to MsgBox than Debug Print dynamic web pages

0 votes

When getting ready to develop a pure vba simple javascript engine today, I came across something really interesting. I would anticipate receiving what it outputs in MsgBox if I pulled the content via http. the website's plaintext code with javascript tags, etc. I can make that work. Nevertheless, if it only outputs in the manner I require to the msgbox or a wscript object popup, I am unable to use it. But, the outcome is what you see in debug if you attempt to print it to a file, cell, etc. print.

The response in the messagebox contains all of the website's javascript and html code, just as it would appear if you viewed the page source in a browser. We're delighted you wish to use your Quickbase more, says the response in a new HTML format in debug.print. without utilising the quickbase api, trying to scrape a quickbase page.

I'm quite interested to know what's happening. different types of variables? VarType makes no mention of that. It cannot be a problem on the server's end. Not to my knowledge. I've read the documentation, but I still don't understand. What is happening?

grab = CreateObject(WinHttp.WinHttpRequest.5.1")
grab.Open
.SetRequestHeaders "irrelevant", "Really doesn't matter what I'm setting as my headers"
grab.send
' Here's the weird part...
resptext = grab.responseText
respbody = grab.responseBody
debug.print(resptext)
MsgBox(resptext)
string_of_byte_array = StrConv(respbody, vbUnicode)
debug.print(string_of_byte_array)
MsgBox(string_of_byte_array)

Appreciate any clarification you can offer.

Feb 27, 2023 in Others by Kithuzzz
• 38,020 points
947 views

1 answer to this question.

0 votes
The Immediate pane has a built-in limit of 200 lines, so if you use Debug.Print to transmit a lengthy string (or a series of shorter strings), you will only see the latest 200 or so lines.
Msgbox would display the first line of content (the max size of msgbox content is approx. 1024 characters). A cell can have a maximum of around 32k characters.

I hope this helps you.
answered Mar 18, 2023 by narikkadan
• 63,680 points

Related Questions In Others

0 votes
1 answer

Trying to run different macros based on value of cell in a range

This demonstrates one approach to loop through ...READ MORE

answered Jan 19, 2023 in Others by narikkadan
• 63,680 points
433 views
0 votes
1 answer

How to make a auto counter to print pages

This will loop through all of those ...READ MORE

answered Jan 19, 2023 in Others by narikkadan
• 63,680 points
419 views
0 votes
1 answer

Given a column of int64, make a REST call for each value, return results to a single table

It would be best if you read. ...READ MORE

answered Jan 21, 2023 in Others by narikkadan
• 63,680 points
537 views
0 votes
1 answer

Why is my excel calculation bringing back a "value" other than zero?

Column D's formula should be changed so ...READ MORE

answered Apr 9, 2023 in Others by narikkadan
• 63,680 points
474 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
1,173 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
3,614 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 23,260 points
872 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
1,026 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP