- This topic is empty.
-
AuthorPosts
-
October 29, 2003 at 12:41 pm #2632
Anonymous
MemberI have been trying to program automated faxing from my Access 2000 application using VBA and the Winfax SDK. I am using version 9 of Winfax. My problem is that the 1st time I try to fax from my application after starting it, Winfax delivers its cover page to be filled in. Every time after the first time, it works fine.
Any help would be appreciated. Here is my function that sends an Access report to Winfax. (BTW, no cover page is supposed to be generated.)
Public Function SendFax(strReportName As String, strReportWhere As String, strSubject As String, _
aryRecipientName() As String, aryRecipientTelNo() As String, aryRecipientCompany() As String) As Boolean
Dim objSendFax As Object, X As Integer, intUBound As Integer, RetCode As Variant
SendFax = False
intUBound = UBound(aryRecipientName)
strOrigDefaultPrinter = GetDefaultPrinter
If Not SetDefaultPrinter(“WinFax”) Then
MsgBox “Cannot find a ‘WinFax’ printer configured on this computer.” & vbCrLf & _
“Therefore cannot fax.”, vbOKOnly, “Can not fax.”
Exit Function
End If
Set objSendFax = CreateObject(“Winfax.SDKSend”)
With objSendFax
RetCode = .ResetGeneralSettings
For X = 0 To intUBound
RetCode = .SetAreaCode(“”)
RetCode = .SetCountryCode(“”)
RetCode = .SetDialPrefix(“”)
RetCode = .SetTo(aryRecipientName(X))
RetCode = .SetNumber(aryRecipientTelNo(X))
RetCode = .SetExtension(“”)
RetCode = .SetPreviewFax(0)
RetCode = .EnableBillingCodeKeyWords(0)
RetCode = .SetUseCover(0)
RetCode = .SetUseCreditCard(0)
RetCode = .SetResolution(1)
RetCode = .SetUsePrefix(0)
RetCode = .SetDeleteAfterSend(0)
RetCode = .SetSubject(strSubject)
RetCode = .SetCompany(aryRecipientCompany(X))
RetCode = .ShowCallProgress(1)
RetCode = .SetPrintFromApp(1)
If .AddRecipient() = 1 Then
MsgBox “Could not add recipient.”, vbOKOnly
Exit Function
End If
Next X
RetCode = .Send(0)
RetCode = .showsendscreen(0)
Do While .isreadytoprint = 0
DoEvents
Loop
.done
End With
DoCmd.OpenReport strReportName, acViewPreview, , strReportWhere
DoCmd.PrintOut acPrintAll
DoCmd.Close acReport, strReportName
SendFax = True
ExitSendFax:
If Not SetDefaultPrinter(strOrigDefaultPrinter) Then
MsgBox “Can not restore the original default printer.” & vbCrLf & _
“Please check your printer settings.”, vbOKOnly, “Error!”
End If
Set objSendFax = Nothing
End FunctionOctober 29, 2003 at 4:56 pm #4443Anonymous
MemberTry removing this code, as it is specific to cover pages
RetCode = .SetSubject(strSubject)
RetCode = .SetCompany(aryRecipientCompany(X))also remove this:
RetCode = .EnableBillingCodeKeyWords(0)
October 30, 2003 at 1:17 am #4444Anonymous
MemberThank you. It worked!
Jerry
-
AuthorPosts
- You must be logged in to reply to this topic.