Public Sub sendsms(sSendNumber As String, sInText As String, iTimeOut As Integer)
Dim iMaxLength As Integer
Dim bAllText
Dim sSendText() As String
Dim iSendAmt As Single
Dim iLastMsg As Integer
ReDim sSendText(0)
bAllText = False
iMaxLength = 86
iLastMsg = Len(sInText) Mod iMaxLength
iSendAmt = 1
If Len(sInText) > iMaxLength Then
iSendAmt = Len(sInText) / iMaxLength
If iSendAmt > Int(iSendAmt) Then
iSendAmt = Int(iSendAmt) + 1
Else
iSendAmt = Int(iSendAmt)
End If
If iLastMsg = 0 Then
iLastMsg = iMaxLength
End If
For x = 0 To iSendAmt - 1
ReDim Preserve sSendText(x)
If x < iSendAmt - 1 Then
sSendText(x) = "#" & x + 1 & "/" & iSendAmt & " - " & Mid(sInText, (iMaxLength * x) + 1, iMaxLength) & " ->"
Else
sSendText(x) = "#" & x + 1 & "/" & iSendAmt & " - " & Mid(sInText, (iMaxLength * x) + 1, iMaxLength)
End If
Next x
Else
sSendText(0) = "#" & x + 1 & "/1" & sInText
End If
For x = 0 To UBound(sSendText)
sendfunction sSendText(x), sSendNumber, iTimeOut
Next x
End Sub
Public Sub sendfunction(sSendText As String, sSendNumber As String, iTimeOut As Integer)
Dim Web As New InternetExplorer
Web.Navigate "http://www.vit.is/spsms/"
Dim Timer As Integer
Dim Target As Integer
Timer = Second(Time)
Target = (Timer + iTimeOut) Mod 60
Do Until Web.ReadyState = READYSTATE_COMPLETE
Timer = Second(Time)
If Timer = Target Then
Exit Sub
End If
Loop
Set oObject = Web.Document.getElementsByName("txtSimanumer")
oObject(0).Value = sSendNumber
Set oObject = Web.Document.getElementsByName("txtSkilabod")
oObject(0).Value = sSendText
Web.Document.Forms(0).submit
Set oObject = Nothing
Set Web = Nothing
End Sub