从Excel VBA发送短信 [英] Send SMS from Excel VBA

查看:691
本文介绍了从Excel VBA发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有适用于我的Excel应用程序的代码.这是会员忠诚度计划,每次向会员收费时,都会发送当前的账单金额以及所赚取或兑换的积分.

I have code for my Excel application. It's a membership loyalty program and every time members are billed it will send the current billed amount along with points earned or redeemed.

我已经购买了一个批量SMS帐户,他们已经向我提供了API.我需要在代码中使用此API.

I have purchased a bulk SMS account and they have provide me the API. I need to use this API in my code.

下面是我的批量SMS提供程序提供的API.

Below is the API provided by my bulk SMS provider.

https://malert.in/api/api_http.php?username=user&password=pwd&senderid=myid&to=9000000000&text=Hello%20world&route=Enterprise&type=text&datetime=2018-02-22%2012%3A54%3A22

推荐答案

假设您的SMS使用https get请求提供,那么这里是示例.

Assume your SMS provide using a https get request, then here is example.

Sub Test_SMS()

'  //this should work with if winhttp.dll existing in system32 dir. 
'  Dim HttpReq  As New WinHttpRequest


Dim response As String
Dim sURL As String

' //another way to create the HttpReq
Set HttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")

' // build your string
sURL = "https://malert.in/api/api_http.php?username=user&password=pwd&senderid=myid&to=9000000000& text=Hello%20world&route=Enterprise&type=text&datetime=2018-02-22%2012%3A54%3A22"

On Error Resume Next

With HttpReq
.Open "GET", sURL, False
.Send
End With

response = HttpReq.responseText
HttpReq.WaitForResponse
Debug.Print response

End Sub

这篇关于从Excel VBA发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆