VBAでチャットワークの自分が入っているルームID (rood_id) の一覧を取得する方法
チャットワークのツールを作っていて、自分が入っているルームIDの一覧が必要だったけど、数が多くて簡単に取得できなかったので、作ってみました。
https://developer.chatwork.com/ja/endpoints.html
最初、debug.printでイミディエイトウィンドウに出していたのだけど、文字数の都合で入りきらなかったので、ファイル出力するように作成。
使いまわしとか考えていない簡易版。
Sub getChatworkRoomList()
Dim httpReq As Object
Set httpReq = CreateObject("MSXML2.XMLHTTP")
With httpReq
.Open "GET", "https://api.chatwork.com/v2/rooms"
.setRequestHeader "X-ChatWorkToken", "chatwork token id"
.Send
Do While .readyState < 4
DoEvents
Loop
Open "C:test.txt" For Output As #1
Print #1, .responseText
Close #1
Debug.Print .responseText
End With
Set httpReq = Nothing
End Sub