Fax Software

Community Forums

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2533
    kebaldwin
    Member

    I am running Windows 98 SE, Celeron 900 MHz, 256 MB RAM, Word 2000 SP2, WinFax Pro 10.02, VB 6 SP 5

    I am doing a mail merge from Visual Basic where I set up WinFax Pro and then print from Word. This randomly causes a VB runtime error 80010105 (Method ‘PrintOut’ of object ‘Document’ failed). For example, out of 425 records it only failed on records 10, 61, 62, 89, 117, and 177 (then I reset the computer) and it failed on records 276, 362, and 403. I looked at those specific records and did not see anything special characters or anything like that.

    I added some delay loops around the Word print statement that is causing an error and I don’t think that helps. I also stopped Winfax from sending faxes while I filled the Outbox, and that seemed to cut the errors in half, although I can’t really prove this.

    Any ideas??? Thanks!

    Portion of VB code that interfaces to WinFax:
    ‘ IF strSendDate = vbNullString THEN the fax is sent immediately
    ‘ Otherwise the fax is delayed until 8 AM of the date specified
    Function SendFax(ByVal strSendDate As String) As Long
    Dim objWinFaxSend As CSDKSend
    Dim lngReturnCode As Long
    Dim sngStartTime As Single

    txtStatus.Text = “Creating object”
    Set objWinFaxSend = New CSDKSend
    ‘ Call GetNewRecipient
    txtStatus.Text = “Setting Options”
    ‘ Call Delay(1000)
    ‘ set client ID must be the first first method invoked after the creation of the Send object
    lngReturnCode = objWinFaxSend.SetClientID(strRecipientCompanyName)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetClientID”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    ‘ Begin Job Settings
    lngReturnCode = objWinFaxSend.ResetGeneralSettings()
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: ResetGeneralSettings”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.LeaveRunning()
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: LeaveRunning”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.SetTo(strRecipientPersonName)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetTo”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.SetNumber(strRecipientFaxNumber)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetNumber”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.SetCompany(strRecipientCompanyName)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetNumber”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    If (strAreaCode <> “919”) Then
    lngReturnCode = objWinFaxSend.SetUseCreditCard(1)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetUseCreditCard”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.SetAreaCode(strAreaCode)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetAreaCode”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    End If
    If (Len(strSendDate) > 0) Then
    lngReturnCode = objWinFaxSend.SetDate(strSendDate)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetDate”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.SetTime(“08:00:00”)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetTime”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    End If

    lngReturnCode = objWinFaxSend.SetResolution(1)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetResolution”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    ‘ lngReturnCode = objWinFaxSend.SetDeleteAfterSend(1)
    lngReturnCode = objWinFaxSend.SetUseCover(0)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetUseCover”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.AddRecipient()
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: AddRecipient”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    lngReturnCode = objWinFaxSend.AddAttachmentFile(“C:My DocumentsFaxSIGeneral.fxm”)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: AddAttachmentFile”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    ‘ lngReturnCode = objWinFaxSend.ShowSendScreen(0)
    lngReturnCode = objWinFaxSend.SetPrintFromApp(1)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: SetPrintFromApp”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    ‘ this routine waits until “IsReadyToPrint” returns a Non-zero value (ready)
    ‘ this loop will wait but allow background processing to continue
    txtStatus.Text = “Waiting for Ready to Print”
    ‘ Call Delay(1000)
    sngStartTime = Timer
    Do While (objWinFaxSend.IsReadyToPrint = 0)
    If (Timer – sngStartTime > 15) Then
    MsgBox “Error: timed out waiting for Fax Ready to Print”
    SendFax = 1
    Exit Do
    End If
    DoEvents
    Loop

    ‘ Call Delay(1000)
    lngReturnCode = objWinFaxSend.Send(1)
    If (lngReturnCode = 1) Then
    MsgBox “ERROR: Send”
    SendFax = 1
    GoTo CLEAN_UP
    End If
    ‘ Call Delay(1000)
    txtStatus.Text = “Printing Fax pages”
    Call PrintCoverPage1
    ‘ Call Delay(1000)

    ‘ 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
    txtStatus.Text = “Waiting for Fax ID number”
    sngStartTime = Timer
    Do While objWinFaxSend.IsEntryIDReady(0) <> 1
    If (Timer – sngStartTime > 15) Then
    MsgBox “Error: timed out waiting for Fax Entry ID”
    SendFax = 1
    Exit Do
    End If
    DoEvents
    Loop

    ‘ Call Delay(1000)
    strLastFaxEntryId = objWinFaxSend.GetEntryID(0)
    ‘ Call Delay(1000)
    SendFax = 0 ‘ Everything executed okay

    CLEAN_UP:
    ‘ Close it down.
    Set objWinFaxSend = Nothing
    txtStatus.Text = “All finished”
    ‘ Call Delay(1000)

    End Function

    ***********************************

    Code for manipulating Word:
    Public Sub PrintCoverPage1()
    Dim wordApp As Word.Application
    Dim wordDoc As Word.Document

    ‘ Create new hidden instance of Word.
    Set wordApp = New Word.Application
    Set wordDoc = wordApp.Documents.Open(FileName:=”c:My DocumentsCover1.doc”)

    ‘ Call Delay(1000)
    ‘ Move to each bookmark and insert text from the form.
    wordDoc.Bookmarks(“PersonName”).Select
    wordApp.Selection.Text = strRecipientPersonName
    wordDoc.Bookmarks(“CompanyName”).Select
    wordApp.Selection.Text = strRecipientCompanyName

    Call Delay(1000)
    ‘ print the document in the foreground so Word
    ‘ will not close until the document finishes printing.
    wordDoc.PrintOut

    Call Delay(1000)
    If (wordApp.BackgroundPrintingStatus > 0) Then
    DoEvents
    End If

    Call Delay(2000)
    ‘ Close the document without saving changes.
    wordDoc.Close SaveChanges:=wdDoNotSaveChanges
    Call Delay(1000)

    ‘ Quit Microsoft Word and release the object variables
    wordApp.Quit
    ‘ Call Delay(1000)
    ‘ Set wordDoc = Nothing
    Set wordApp = Nothing
    ‘ Call Delay(1000)
    End Sub

    #4257
    kebaldwin
    Member

    I forgot to mention that when I change the one line in the Word automation part of the code to “.printout background=false” Word does not print in the background and does not return until printing is completed. In this case, I get a General Protection Fault in WINFAXHQ.DRV (only when it fails — not every time I run it)

    #4258
    kebaldwin
    Member

    It appears to be a problem with the photo quality print driver. The regular print driver appears to work correctly.

    #4259
    Anonymous
    Member

    I’ve always had problems with Background printing in Word, it is recommended to turn it off when printing to WinFax.

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