31 มีนาคม นี้ ทางไลน์จะยกเลิก Line notify แบบที่เราใช้ฟรีกัน เป็นแบบ Messaging API เผื่อมีใครสนใจจะใช้ App Telegram แทน Line ครับ
VBA Code (ใช้ Deepseek generate ให้ครับ) ผมลองเอามาทดสอบแล้วใช้งานได้ปกติ และฟรีด้วยครับ
Sub SendTelegramMessage()
Dim BotToken As String
Dim ChatID As String
Dim MessageText As String
Dim ApiUrl As String
Dim JsonPayload As String
Dim HttpRequest As Object
' Replace with your bot token and chat ID
BotToken = "YOUR_BOT_TOKEN"
ChatID = "YOUR_CHAT_ID"
MessageText = "Hello from Microsoft Access!"
' Construct the API URL
ApiUrl = "
https://api.telegram.org/bot" & BotToken & "/sendMessage"
' Create the JSON payload
JsonPayload = "{""chat_id"": """ & ChatID & """, ""text"": """ & MessageText & """}"
' Create the HTTP request object
Set HttpRequest = CreateObject("MSXML2.XMLHTTP")
' Send the POST request
With HttpRequest
.Open "POST", ApiUrl, False
.setRequestHeader "Content-Type", "application/json"
.send JsonPayload
End With
' Check the response
If HttpRequest.Status = 200 Then
MsgBox "Message sent successfully!", vbInformation
Else
MsgBox "Failed to send message. Status: " & HttpRequest.Status & ", Response: " & HttpRequest.responseText, vbCritical
End If
' Clean up
Set HttpRequest = Nothing
End Sub