I want to send an HTTP request (GET transmission) from VBA, store the response as a character string in a variable, and send it to MsgBox. ? ? It becomes.
Perhaps it is garbled and I am trying to specify the character code using ADODB stream, but it doesn't work.

I'd be happy if you could teach me.

Dim httpReq As Object
Dim strRes As String
Set httpReq = CreateObject ("MSXML2.XMLHTTP")
With httpReq
 .Open "GET", "Parameter URL", False
 strRes = .responseText
End With
Dim st As New ADODB.stream
Call st.WriteText (strRes)
Dim sr As String
sr = st.ReadText
MsgBox sr
Set st = Nothing
  • Answer # 1

    First, let's find out what the character code of the site is.

    Display the source, and understand the character code by describing charset = UTF-8 or charset = Shift_JIS or charset = EUC-JP.

    If UTF-8,

    strRes = .responseText

    There should be no problem.

    If Shift_JIS,

    strRes = StrConv (.responseBody, vbUnicode)

    To convert to Unicode.

    For EUC-JP, the following will be helpful.

    I want to get EUC \ -JP HTML source with VBA and make it Shift \ -JIS [OKWAVE]