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 in Others by Kithuzzz
• 35,300 points
30 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 by narikkadan
• 60,820 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 in Others by narikkadan
• 60,820 points
69 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 in Others by narikkadan
• 60,820 points
77 views
0 votes
1 answer
0 votes
1 answer

What are the different modes to use a VI editor?

VI editor in linux can be use ...READ MORE

answered Mar 8, 2019 in Others by Nabarupa
3,230 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
577 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
2,563 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
• 22,970 points
149 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,630 points
392 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