รบกวนถามปัญหาครับ เราจะส่งข้อความไปในกลุ่มไลน์ ผ่าน line Notify
Posted: Thu Jan 17, 2019 11:31 am
รบกวนถามปัญหาครับ เราจะส่งข้อความไปในกลุ่มไลน์ ผ่าน line Notify
กรณี ข้อความที่จะส่ง มีมากกว่า 1 cell เราจะแก้ โค๊ดอย่างไรครับ
Code
Public Sub Send()
Dim myURL As String
Dim Sender As String
Dim numbers As String
Dim Message1 As String
Dim day1 As String
Dim monthyear As String
Dim postData As String
Dim winHttpReq As Object
Message1 = WorksheetFunction.EncodeURL(Sheets(Sheets(1).Name).Range("aa1").Text)
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
myURL = "https://notify-api.line.me/api/notify"
postData = "message=" + Message1
winHttpReq.Open "POST", myURL, False
winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
winHttpReq.SetRequestHeader "Authorization", "Bearer xxx"
winHttpReq.Send (postData)
End Sub
กรณี ข้อความที่จะส่ง มีมากกว่า 1 cell เราจะแก้ โค๊ดอย่างไรครับ
Code
Public Sub Send()
Dim myURL As String
Dim Sender As String
Dim numbers As String
Dim Message1 As String
Dim day1 As String
Dim monthyear As String
Dim postData As String
Dim winHttpReq As Object
Message1 = WorksheetFunction.EncodeURL(Sheets(Sheets(1).Name).Range("aa1").Text)
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
myURL = "https://notify-api.line.me/api/notify"
postData = "message=" + Message1
winHttpReq.Open "POST", myURL, False
winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
winHttpReq.SetRequestHeader "Authorization", "Bearer xxx"
winHttpReq.Send (postData)
End Sub