- This topic is empty.
-
AuthorPosts
-
October 22, 2002 at 5:45 am #2524
Anonymous
MemberIn my A2K app, I am able to invoke SetPreviewFax, no problem. Or I can add attachments to the fax, but when I try to do both operations at the same time, the following error appears:
“Unable to send event to …. because Attachment index is corrupt.”
I’ve tried deleting attach.db, but the results are the same.
Any assistance with this problem will be greatly appreciated.
The following is the standard sample code with the exception of allowing multiple attachments:
*********************************************
Public Sub SENDFAX(strFULLNAME As String, strNUMBER As String, strCOMPANY As String, strKEYWORDS As String, strSubject As String, strTEXT As String, strATT() As String)
Dim objWinFaxSend As Object, intX As Integer
Dim sdk_ret As Variant, strATTACHMENT As String
On Error GoTo SF_ERROR
Set objWinFaxSend = CreateObject(“WinFax.SDKSend8.0”)
objWinFaxSend.SetClientID (“Client Name”)‘Here you set the recipient details
sdk_ret = objWinFaxSend.SetTo(strFULLNAME)
sdk_ret = objWinFaxSend.SetNumber(strNUMBER)
‘These are optional recipient details
sdk_ret = objWinFaxSend.SetCompany(strCOMPANY)
sdk_ret = objWinFaxSend.SetKeywords(strKEYWORDS)
‘sdk_ret = objWinFaxSend.SetBillingCode(strBILLINGCODE)
sdk_ret = objWinFaxSend.SetPreviewFax(1)‘ Set subject line
sdk_ret = objWinFaxSend.SetSubject(strSubject)
sdk_ret = objWinFaxSend.SetUseCover(0)
sdk_ret = objWinFaxSend.SetCoverFile(“C:Program FilesWinFaxCoverCompanyCover.cvp”)
sdk_ret = objWinFaxSend.SetCoverText(strTEXT)
‘Specify an attachment filename(s) here (optional)
For intX = 0 To UBound(strATT)
If Len(Trim(strATT(intX) & Space(1))) > 0 Then
strATTACHMENT = strATT(intX)
sdk_ret = objWinFaxSend.AddAttachmentFile(strATTACHMENT)
End If
Next‘ now add the recipient
sdk_ret = objWinFaxSend.AddRecipient()
‘ If you want to print from another application, you need to use ‘ this.
‘sdk_ret = objWinFaxSend.SetPrintFromApp(1) ‘ set to 1 because you are going to print.
sdk_ret = objWinFaxSend.ShowSendScreen(0) ‘ set to 0 so the send dialog does not appear
sdk_ret = objWinFaxSend.Send(1)
‘ set to 1 so it returns an EVENT ID
‘ this routine waits until “IsReadyToPrint” returns a Non-zero ‘ value (ready)
‘ this loop will wait but allow background
‘ processing to continueDo While objWinFaxSend.IsReadyToPrint = 0
DoEvents
Loop‘ Print the document
‘ IF YOU REQUIRE OUTPUT FROM ANOTHER APPLICATION
‘ DO ALL THE PRINTING FUNCTIONALITY HERE
‘ this is where you write code to print the document to WINFax.
‘ The printer should be already set to “WinFax” or you need to add ‘ code to change the printer driver to WinFax.
‘ 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
DoEvents
Loop
‘ We are done!
‘ Loop for the next recipient
‘ (go back to the begining for the next recipient)
SF_EXIT:
Set objWinFaxSend = Nothing
Exit SubSF_ERROR:
MsgBox Err.Number & ” ” & Err.Description, vbCritical
Resume SF_EXIT
End Sub -
AuthorPosts
- You must be logged in to reply to this topic.