VB Fax - Cancel a Pending Fax in VB6

Download the VB fax (VB6) code samples.

To cancel a previously-submitted VB fax, use the CancelFax method. CancelFax only affects faxes waiting to be sent (with the status codes: -1 Preprocessing, -2 Ready, or -3 Pending Retry), and not faxes that are currently being transmitted.

The following VB6 fax snippet cancels a fax and checks if the cancellation succeeded:

Attribute VB_Name = "CancelFax"
' This method submits a 'Cancel' request for a pending VB fax
' To cancel an entire broadcast (batch), use the CancelBatch() method
Option Explicit
Const TransactionID As Long = 129040055
Public Sub Invoke()
Dim Result As Long
Dim objEnv As PocketSOAP.CoEnvelope
Dim objHttp As PocketSOAP.HTTPTransport
Set objEnv = New PocketSOAP.CoEnvelope
objEnv.EncodingStyle = ""
objEnv.SetMethod "CancelFax", "http://www.interfax.cc"
objEnv.Parameters.Create "Username", Main.Username, objEnv.URI
objEnv.Parameters.Create "Password", Main.Password, objEnv.URI
objEnv.Parameters.Create "TransactionID", TransactionID, objEnv.URI
Set objHttp = New PocketSOAP.HTTPTransport
objHttp.SoapAction = "http://www.interfax.cc/CancelFax"
objHttp.Send "http://ws.interfax.net/DFS.asmx", objEnv.Serialize
objEnv.parse objHttp
Result = objEnv.Parameters.Item(0).Value
If Result < 0 Then
    MsgBox ("Bad status=" & Result)
    MsgBox ("TransactionID: " & TransactionID & " cancel request has been queued")
End If
Set objEnv = Nothing
Set objHttp = Nothing
End Sub