تفضل التعديل و لا تنسى تضيف رقم الحساب و المفتاح
Function SendSMS(fromNumber As String, toNumber As String, body As String)
Dim SmsUrl, ACCOUNTSID, AUTHTOKEN As String
ACCOUNTSID = "ACCOUNT SID" ' ضع هنا رقم الحساب
AUTHTOKEN = "AUTH TOKEN" ' ضه ضع هنا مفتاح الحساب
On Error GoTo Error_Handler
SmsUrl = "https://api.twilio.com" & "/2010-04-01/Accounts/" & ACCOUNTSID & "/SMS/Messages"
Dim http As MSXML2.XMLHTTP60
Set http = New MSXML2.XMLHTTP60
http.Open "POST", SmsUrl, False, ACCOUNTSID, AUTHTOKEN
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Dim postData As String
postData = "From=" & fromNumber _
& "&To=" & toNumber _
& "&Body=" & body
http.send postData
Debug.Print http.responseText
If http.status = 201 Then
ElseIf http.status = 400 Then
MsgBox "Failed with error# " & _
http.status & _
" " & http.statusText & vbCrLf & vbCrLf
ElseIf http.status = 401 Then
MsgBox "Failed with error# " & http.status & _
" " & http.statusText & vbCrLf & vbCrLf
Else
MsgBox "Failed with error# " & http.status & _
" " & http.statusText
End If
Exit_Procedure:
On Error Resume Next
Set http = Nothing
Exit Function
Error_Handler:
Select Case Err.Number
Case NOINTERNETAVAILABLE
MsgBox "Connection to the internet cannot be made or " & _
"Twilio website address is wrong"
Case Else
MsgBox "Error: " & Err.Number & "; Description: " & Err.Description
Resume Exit_Procedure
Resume
End Select
End Function
ODB_Database.zip