Я пробовал, но это не сработало, где я не прав?
Я думаю, что проблема в преобразовании файла для передачи через запрос POST
https://core.telegram.org/bots/api#sendphoto] 1
Sub SendPhoto()
Dim token As String: token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
'--- read file
Dim adoStream
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Mode = 3 ' read write
adoStream.Type = 1 ' adTypeBinary
adoStream.Open
adoStream.LoadFromFile ("C:\photo.png")
adoStream.Position = 0
'--- post
Dim strPostData As String
Dim strResponse As String
strPostData = "chat_id=xxxxxxxx&photo=" & adoStream.Read()
Dim HTTPReq As Object
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTPReq.Open "POST", "https://api.telegram.org/bot" & token & "/sendPhoto", False
HTTPReq.setRequestHeader "Content-Type", "multipart/form-data"
HTTPReq.send (strPostData)
Debug.Print HTTPReq.responseText
Set HTTPReq = Nothing
Set adoStream = Nothing
End Sub