I want to copy a range of cells in excel sheet and send it via telegram bot as a picture programmatically using VBA.
Here I copy the range as a picture:
Dim rCopy As Range
Set rCopy = ThisWorkbook.ActiveSheet.Range("A14:C14")
rCopy.copyPicture
This code sends HTTP request to the Telegram API:
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "https://api.telegram.org/bot<TOKEN>/sendPhoto?chat_id=<ID>&photo=" & rCopy
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("")
But I do not know how to get the file from Clipboard and put it to the request.