Fax Software

Community Forums

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #2681

    I am trying to fax a batch of word documents, containing work orders,
    to techs on a daily basis.
    The tech names are stored in a table, along with their associated FAX

    I have MS Access VBA that looks something like this…


    'Initialize WinFax Pro for faxing.
    ChanNum = DDEInitiate("FAXMNG32", "CONTROL")
    DDEExecute ChanNum, "GoIdle"
    DDETerminate ChanNum

    'Fax work orders one at a time.
    For I = 1 To I

       MyTechFaxName = DLookup("[TechName]", "tblTechInformation",
    "[TechFaxDocument]='" & MyFileNameArray(I) & "'")
       MyTechFaxNumber = Left(MyFileNameArray(I), 13)
       MyTechFaxAttachment = "C:TechSenderOutbox" & MyFileNameArray(I)

       Call SendFax(MyTechFaxName, MyTechFaxNumber, MyTechFaxAttachment)

    Next I

    ChanNum = DDEInitiate("FAXMNG32", "CONTROL")
    DDEExecute ChanNum, "GoActive"
    DDETerminate ChanNum


    Now, my function SendFax looks like this...


    Function SendFax(MyRecip As String, MyFAXNumber As String, MyAttachment
    As String)

       Dim ChanNum
       Dim IsReady As Integer
       Dim lRet As Long
       Dim MyFAXMsg As Integer
       Dim objFax As Object
       Dim objLog As Object
       Dim strEntryID As String

       Set objFax = CreateObject("WinFax.SDKSend")
       Set objLog = CreateObject("WinFax.SDKLog")

       lRet = objFax.SetHold(0)
       lRet = objFax.SetSubject("Daily Work Order Fax")    'Set FAX
       lRet = objFax.SetNumber(MyFAXNumber)                'Set FAX phone
       lRet = objFax.SetTo(MyRecip)                        'Set FAX
       lRet = objFax.SetCompany("Kimberlite Corporation")  'Set FAX
    company name
       lRet = objFax.AddAttachmentFile(MyAttachment)
       lRet = objFax.ShowSendScreen(0)                     '1=Show, 0=Hide
       lRet = objFax.ShowCallProgress(1)                   '1=Show, 0=Hide
       lRet = objFax.AddRecipient
       lRet = objFax.Send(1)                               '1=Return
    EventID, 0=No EventID
       Do While objFax.IsReadyToPrint() = 0

       lRet = objFax.Done
       lRet = objFax.LeaveRunning

       Set objFax = Nothing

    End Function

    I have WinFax Automation Server referenced in my Tools–>References.

    My problem is, when the code cycles through the table of tech names and
    tries to send each tech their fax, it leaves a Send dialog window open,
    even though I tell it, with code, not to display.

    I am using WinFax Pro version 10.03…

    Edited By Moderator on 1156952918


    before you set the object = nothing, you need WinFax to allow processing of the fax. You’re not doing that…

    you might need :

    Do While objFax.IsEntryIDReady(0) <> 1

    before your .Done and .LeaveRunning code.. that may help.

    Edited By Moderator on 1156952878


    Well, I added that code, but it still randomly opens the send dialog window and freezes moving to the next database entry.

    Is there a way for me to detect when a tech’s fax has been successfully added to the outbox?

    I think it works fine once I have all outgoing faxes in the outbox…


    you can try adding a few seconds of a delay before you set objFax = nothing, that may help.

    also remove the create object “objLog” line of code, because everytime you are calling that function you’re creating a new instance of SDKLog. Not sure if you’re even using SDKLog, but if you are, make sure you Set objLog = Nothing in your code before you create a new instance of it.

    I just tried this code and it works fine sending an attachment (txt file) replace the variables with something valid on your system and try it.

    ' Define variables to use with WinFax automation.
    Dim strRecipient As String
    Dim strFaxNumber As String
    Dim strAttachment As String

    ' set variables
    strRecipient = "Symantec Corporation"
    strFaxNumber = "416-555-2323"
    strAttachment = "c:program fileswinfaxreadme.txt"

    'Open an instance of WinFax
    Dim objWinFaxSend As Object
    Set objWinFaxSend = CreateObject("WinFax.SDKSend8.0")

    objWinFaxSend.SetClientID ("Client Name")

    ' Begin Recipient Settings

    RetCode = objWinFaxSend.SetTo(strRecipient)
    RetCode = objWinFaxSend.SetNumber(strFaxNumber)

    ' Begin Job Settings

    RetCode = objWinFaxSend.AddAttachmentFile(strAttachment)
    RetCode = objWinFaxSend.SetResolution(1)

    RetCode = objWinFaxSend.AddRecipient()

    RetCode = objWinFaxSend.Send(1)

    RetCode = objWinFaxSend.ShowSendScreen(0)

    '  this routine waits until "IsReadyToPrint"
    '  returns a Non-zero  value (ready)
    '  this loop will wait but allow background
    '  processing to continue

       Do While objWinFaxSend.IsReadyToPrint = 0

    ' Wait until the EntryID is ready before moving on.
    ' the Send(1) you specified before is used here.
    ' We don't care what the EntryID is,
    ' we just want to know that is it ready.  
    ' this loop will wait but allow
    ' background processing to continue
    ' when ready IsEntryIDReady is not = to 1

     Do While objWinFaxSend.IsEntryIDReady(0) <> 1

    ' Close it down.
    Set objWinFaxSend = Nothing

    Edited By Moderator on 1157655550


    OK. I have removed the reference to objLog.

    Is there code I can add that will let me wait until my Word documents have been converted to Fx, as well as let me know when it has been entered into the Outbox?


    Hello…? Anyone out there…? Asked a question…???

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.