не может загрузить изображение PNG в VBA
Private Sub btnCreate_Click()
Dim readFile
If (txtData.text = "") Then
MsgBox "Please Enter Data"
Else
Dim objWinHttp As Object
Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim URL As String
URL = "https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=" + txtData.text + "&choe=UTF-8"
objWinHttp.Open "GET", URL, False
objWinHttp.send ""
SaveBinaryData "E:\qr.png", objWinHttp.responseBody
Image1.Picture = LoadPicture("E:\qr.png")
End If
End Sub
Функция Сохранить BinaryData
Function SaveBinaryData(FileName, Data)
Const adTypeText = 1
Const adSaveCreateOverWrite = 2
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeText
BinaryStream.Open
BinaryStream.Write Data
BinaryStream.saveToFile FileName, adSaveCreateOverWrite
BinaryStream.Close
End Function
Ошибка "Недопустимая картинка"
Спасибо всем за чтение