使用VBA通过VoipBuster发送短信

时间:2013-03-28 10:37:15

标签: excel vba excel-vba sms

我是初学者,但我正在尝试在VBA中创建一个宏来在条件完成时使用VoipBuster平台发送短信。

有可能吗?是否更容易使用安装在PC或网页上的应用程序(https://www.voipbuster.com/sms)。

请帮忙!

2 个答案:

答案 0 :(得分:1)

对于来自voipbuster的发送短信,你可以通过php vars发送它...
"https://www.voipbuster.com/myaccount/sendsms.php?username=$USER&password=$PASS&from=$FROM&to=\"$TO\"&text=$SMS_TEXT"

所以你需要像这样从vba访问iexplore,创建vars使用,传递,发送文本等等,然后像URL一样连接各种各样的..

从VBA调用iexplore你会发现google有很多方法,这里有一个例子

Private Sub IE_Autiomation()
    Dim i As Long 
    Dim IE As Object 
    Dim objElement As Object
    Dim objCollection As Object

    ' Create InternetExplorer Object
    Set IE = CreateObject("InternetExplorer.Application")

    ' You can uncoment Next line To see form results
    IE.Visible = False

    ' Send the form data To URL As POST binary request
    IE.Navigate "https://www.voipbuster.com/myaccount/sendsms.php?username=$USER&password=$PASS&from=$FROM&to=\"$TO\"&text=$SMS_TEXT"

答案 1 :(得分:1)

尝试以下代码。您还可以通过将URL变量中的值放入浏览器进行测试。

Sub SendSms()

    Dim username As String
    Dim password As String
    Dim sendTo As String
    Dim msg As String

    username = "test" 'enter username here
    password = "test" 'enter password here
    sendTo = "9999999999"
    msg = "Hello"

    Dim URL As String
    URL = "https://www.voipbuster.com/myaccount/sendsms.php?username=" & username & "&password=" & password & "&to=" & sendTo & "&text=" & msg

    Dim xml As Object
    Set xml = CreateObject("MSXML2.XMLHTTP")
    xml.Open "GET", URL, False
    xml.send
End Sub