Dim httpReq As MSXML2.XMLHTTP60
Set httpReq = New MSXML2.XMLHTTP60
MSXML2.XMLHTTP これではだめでバージョンの60が必要。
'
' チャットワークへ原料 Macro
'
Sub sendChat(ByVal roomId As String, ByVal message As String)
Const API_TOKEN As String = "**トークン**"
Const ROOM_ID As String = "*****" 'ルームID
Dim httpReq As MSXML2.XMLHTTP60
Set httpReq = New MSXML2.XMLHTTP60
With httpReq
.Open "POST", "https://api.chatwork.com/v2/rooms/" & roomId & "/messages"
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "X-ChatWorkToken", API_TOKEN
.Send "body=" & message
End With
Set httpReq = Nothing
End Sub
Windows11の時代にようやく、Windows7から10への引っ越しだけど本当に疲れた。
ありがとう!
みるくP ブログ » Blog Archive » 【Excel VBA】MSXML2がWindows10で動かない