สอบถาม VBA ส่งรูปผ่าน Line notify ครับ
Posted: Mon Jan 22, 2018 11:45 am
คือผมติดปัญญาการอ้างอิงรูปภาพครับ ไม่สามารถอ้างอิงได้
Sub SendMessageToLineNotify()
Dim oXML As Object
Dim strToken As String
Dim strMessage As String
Dim strDate As String
Dim URL As String
'Line Notify Token
strToken = Sheet1.Range("B1")
'Line Notify
URL = "https://notify-api.line.me/api/notify"
strDate = Format(Now, "DD/MM/YYYY - HH:MM:SS")
Pic = "C:\Users\11209244\Desktop\Sales Forecast V12.jpg"
'Line Message
strMessage = "message=" & strDate & Pic
'Ajax
Set oXML = CreateObject("Microsoft.XMLHTTP")
With oXML
'Line Post
.Open "POST", URL, 0
'Header
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.SetRequestHeader "Authorization", "Bearer " & strToken
'Ajax
.send (strMessage)
'Line Check Print
Debug.Print oXML.responseText
End With
'Line
Set oXML = Nothing
End Sub
Sub SendMessageToLineNotify()
Dim oXML As Object
Dim strToken As String
Dim strMessage As String
Dim strDate As String
Dim URL As String
'Line Notify Token
strToken = Sheet1.Range("B1")
'Line Notify
URL = "https://notify-api.line.me/api/notify"
strDate = Format(Now, "DD/MM/YYYY - HH:MM:SS")
Pic = "C:\Users\11209244\Desktop\Sales Forecast V12.jpg"
'Line Message
strMessage = "message=" & strDate & Pic
'Ajax
Set oXML = CreateObject("Microsoft.XMLHTTP")
With oXML
'Line Post
.Open "POST", URL, 0
'Header
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.SetRequestHeader "Authorization", "Bearer " & strToken
'Ajax
.send (strMessage)
'Line Check Print
Debug.Print oXML.responseText
End With
'Line
Set oXML = Nothing
End Sub