VB Fax - How to Send a Plain-Text Fax in VB6

This sample demonstrates how to send a VB fax (VB6), using the SendCharFax. This method sends a plain-text VB6 fax. Text is limited to standard ASCII (no 8-bit characters), but can include HTML markup.

In the following code snippet, a plain-text file is submitted to the Web service. Wait to receive an indication on whether the submission succeeded: in this case, the return value is the (positive) transaction ID of the fax. Any other return value indicates that the transmission failed (for more details, see the Web Service Return Codes section).


Attribute VB_Name = "SendCharFax"
'
' The simplest method for sending a VB fax.
' Use to send textual document formats, such as Text or html.
'
Option Explicit

Public Sub Invoke()

Dim objEnv As PocketSOAP.CoEnvelope
Dim objHttp As PocketSOAP.HTTPTransport

Set objEnv = New PocketSOAP.CoEnvelope

objEnv.EncodingStyle = ""

objEnv.SetMethod "SendCharFax", "http://www.interfax.cc"
objEnv.Parameters.Create "Username", Main.Username, objEnv.URI
objEnv.Parameters.Create "Password", Main.Password, objEnv.URI
objEnv.Parameters.Create "FaxNumber", "+12125555555", objEnv.URI
objEnv.Parameters.Create "Data", "Hello world!", objEnv.URI
objEnv.Parameters.Create "FileType", "txt", objEnv.URI

Set objHttp = New PocketSOAP.HTTPTransport
objHttp.SoapAction = "http://www.interfax.cc/SendCharFax"
objHttp.Send "http://ws.interfax.net/DFS.asmx", objEnv.Serialize
objEnv.parse objHttp

Dim SendResult As Long
SendResult = objEnv.Parameters.Item(0).Value

If SendResult < 0 Then
    MsgBox ("Bad status=" & SendResult)
Else
    MsgBox ("Fax properly sent; TransactionID: " & SendResult)
End If

Set objEnv = Nothing
Set objHttp = Nothing
End Sub

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today