PowerBuilder – OLE with Facsys to Fax a Document

Posted on Friday, October 2nd, 2009 at 8:23 pm in

Here is a old post I put on Tek-Tips.com way back in 2001.

I have just implemented an OLE faxing solution in my PB7 app using Facsys.

This code creates the session, addresses the fax message, then attaches a previously created MSWord document to the fax.

lole_facsys = Create OLEObject
li_rc = lole_facsys.ConnectToNewObject("facsys.faxsession")
//Check for the return code
If li_rc <> 0 Then
   // ERROR CONDITION
   Messagebox("ERROR",li_rc)
   Destroy lole_facsys
   Return li_rc
End If
// log on to server (SERVER, ID, PASSWORD)
lole_facsys.logon("PRC00","00MNB","")
lole_faxmsg = lole_facsys.createmessage()
lole_faxmsg.text = 'Expedite / De Expedite Notice'
lole_recipient = lole_faxmsg.recipients.add()
lole_recipient.Name = 'Matt Balent'
lole_recipient.faxnumber = '18105555078'
// previously saved word doc
lole_attachmnt = lole_faxmsg.attachments.add('C:\vfax.doc')
lole_attachmnt.type = 14 // MS word
li_rc = lole_faxmsg.send()
destroy lole_attachmnt
destroy lole_recipient
destroy lole_faxmsg
lole_facsys.logoff()
destroy lole_facsys

This assumes you have Facsys installed on the user’s desktop and they have an account on the Facsys server AND that the Facsys server is set up to render the attachment. I used Facsys v 4.7 on the desktop.

Top