- This topic is empty.
-
AuthorPosts
-
February 4, 2002 at 10:21 pm #2533
kebaldwin
MemberI 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 SingletxtStatus.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 IflngReturnCode = 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 okayCLEAN_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 = strRecipientCompanyNameCall Delay(1000)
‘ print the document in the foreground so Word
‘ will not close until the document finishes printing.
wordDoc.PrintOutCall Delay(1000)
If (wordApp.BackgroundPrintingStatus > 0) Then
DoEvents
End IfCall 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 SubFebruary 5, 2002 at 1:17 am #4257kebaldwin
MemberI 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)
February 22, 2002 at 10:25 am #4258kebaldwin
MemberIt appears to be a problem with the photo quality print driver. The regular print driver appears to work correctly.
February 22, 2002 at 2:47 pm #4259Anonymous
MemberI’ve always had problems with Background printing in Word, it is recommended to turn it off when printing to WinFax.
-
AuthorPosts
- You must be logged in to reply to this topic.