Equisys technical notes

Technical guidance, explanations and fixes for our products

HOWTO: Using the Zetafax API from Visual Basic



ID: ZTN1068

This Zetafax technical note applies to:

  • Zetafax 6


This technical note gives an example of using the Zetafax API from a Visual Basic program.

More information

The Zetafax API includes a DLL, containing a number of functions which allow programs to submit faxes, and to monitor and control the fax queue.

Although these functions are documented as "C language callable functions", a Visual Basic header file is also supplied to allow then to be used from Visual Basic programs.

The Visual Basic function in this technical note uses Zetafax API callable functions to take fax addressing as arguments and uses these to automate the submission of a fax.


Option Explicit

Function SendFax(strUserName As String, strFax As String, strName As String, strOrg As String, strSubject As String, strMsg As String) As Boolean

' This function uses the API to send a simple Fax message

On Error GoTo send_error

      Dim iErr As Integer

      Dim lSession As Long

      Dim lError As Long

      Dim iExclusive As Integer

      Dim strBody As String * 9

      Dim strFrom As String

      lError = 0

      iExclusive = 0

      SendFax = False

      'Initialise the API session

      iErr = ZfxAPIInit(lSession, ByVal strUserName, ByVal 0, ByVal 0)

      If iErr = 0 Then

              'Create the submit file

              Open " temp.txt" For Output As #1

              Print #1, " %%[MESSAGE]"

              Print #1, " SUBJECT: " & strSubject

              Print #1, " To: " & strName

              Print #1, " Organisation: " & strOrg

              Print #1, " Fax: " & strFax

              Print #1, " "

              Print #1, " %%[TEXT]"

              Print #1, strMsg

              Close #1

              'Submit the file

              iErr = ZfxSendSubmitFile(lSession, ByVal " temp.txt" , ByVal " test" , ByVal strBody)

              If iErr < > 0 Then

                      MsgBox " ZfxSendSubmitFile error: " & Hex(iErr), vbExclamation


                      MsgBox " Message Sent OK: " & strBody, vbInformation

              End If

              'Finally tidy everything up

              iErr = ZfxAPIClosedown(lSession)


              'Handle initialisation failure

              MsgBox " ZfxAPIInit failed with error: " & Hex(iErr), vbExclamation

              Exit Function

      End If

      SendFax = True


      Exit Function


      MsgBox Err.Description, vbExclamation

      Resume send_tidyup

End Function


For more information on using C language callable functions see the Zetafax API Help section of the ZFSetup.chm file, this can be accessed using the Configuration program.

Last updated: 15 May 2000 (GC/GW)

Equisys Logo, Document Management and Expense Management for Business Central

Replaced by script
Recent news

The sudden rush towards remote working practices in 2020 led many organizations to implement changes to upgrade their document capture processes on Microsoft Dynamics 365 Business Central or ...

Company credit cards are often seen as the most convenient way to incur travel & entertainment expenses, however it can be a very different story when it comes to the administration of these ...

North America
Equisys Inc
30000 Mill Creek Avenue
Suite 335
Alpharetta, GA 30022
(770) 772 7201
Equisys Ltd
91 Southwark Bridge Road
United Kingdom
+44 (0)20 7203 4000

© Equisys Ltd
All rights reserved

© Equisys Ltd    All rights reserved    Contact    Privacy policy    Cookies