- This topic is empty.
-
AuthorPosts
-
September 28, 2006 at 8:18 pm #2608
lynniek
MemberOK….I am trying again. I posted last week code to try to use VBA code to “print” a filtered report to WinFax and fill in the cover page. I never could get this working. I found code on Helen Feddema’s site to use DDE to get information to WinFax. This code works to fill in the cover page. I see the filtered report print but it never shows up in WinFax. I think I have the printing of the report either coded wrong or in the wrong location. I might also be missing something. Any help would be appreciated:
‘Created by Helen Feddema 4-7-2003
‘Last modified 4-7-2003
‘On Error GoTo ErrorHandler
Dim intReturn As Integer
Dim strLastName As String
Dim strcity As String
Dim strMessage As String
Dim strSendTime As String
Dim strSendDate As String
Dim strRecipient As String
Dim lngChannel As Long
Dim strCoverSheet As String
Dim strFax As String
Dim dbs As DAO.Database
Dim dteFax As Date
Dim rst As DAO.Recordset
Dim frm As Access.Form
Dim ctl As Access.Control
Dim strCustomerName As String
Dim strCompany As String
Dim strMessage1 As String
Dim strMessage2 As String
Dim strMessageSubject As String
Dim strTitle As String
Dim strPrompt As String
Dim strWinFaxDir As String
Dim strBody As String
Dim strStreetAddress As String
Dim strlocation As String
Dim strDocName As StringstrDocName = “RPT_QuoteDetailsTotalWF”
gstrReportFilter = “QuoteID = ” & Me.QuoteID‘Test for required fields
strFax = Nz(Me![CustomerFax])
Debug.Print “Fax number: ” & strFax
If strFax = “” Then
MsgBox “No mailing fax number; can’t send fax”
‘GoTo ErrorHandlerExit
End IfstrStreetAddress = Nz(Me![FullAddress])
If strStreetAddress = “” Then
MsgBox “No street address; can’t send fax”
‘GoTo ErrorHandlerExit
Else
strlocation = strStreetAddress & ” in ” & Nz(Me![CityStateZip])
Debug.Print “Location: ” & strlocation
End Ifstrcity = Nz(Me![CityStateZip])
strCustomerName = Nz(Me![contactname])
strCompany = Nz(Me![Customer])
strMessageSubject = “QUOTE FOR: ” & strCustomerName
strMessage = “Quoted by RIL”‘Test for required fields
Debug.Print “Fax: ” & strFax
‘strMessageSubject = Me![txtMessageSubject].Value
‘strBody = Me![txtBody].Value‘Send Fax
If strFax <> “” Then
strCustomerName = Nz(Me![Customer])
strCompany = Nz(Me![Customer])
‘dteFax = Format(Now(), “hh:mm:ss”)
‘strSendDate = Format(dteFax, “mm/dd/yy”)strCoverSheet = WinFaxDir & “COVERBASIC1.CVP”
Debug.Print “Cover sheet: ” & strCoverSheet
Debug.Print strDocName‘***
‘Start DDE connection to WinFax.
‘Create the link and disable automatic reception in WinFax
lngChannel = DDEInitiate(Application:=”FAXMNG32″, topic:=”CONTROL”)
DDEExecute ChanNum:=lngChannel, Command:=”GoIdle”
DDETerminate ChanNum:=lngChannel‘Create a new link with the TRANSMIT topic.
lngChannel = DDEInitiate(“FAXMNG32”, “TRANSMIT”)‘Start DDEPokes to control WinFax.
strRecipient = “recipient(” & Chr$(34) & strFax & Chr$(34) & “,” _
& Chr$(34) & strSendTime & Chr$(34) & “,” _
& Chr$(34) & strSendDate & Chr$(34) & “,” _
& Chr$(34) & strCustomerName & Chr$(34) & “,” _
& Chr$(34) & strCompany & Chr$(34) & “,” _
& Chr$(34) & strMessageSubject & Chr$(34) & “)”
Debug.Print “Recipient string: ” & strRecipient
Debug.Print “Length of recipient string: ” & Len(strRecipient)
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, Data:=strRecipient‘Specify cover page
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, _
Data:=”setcoverpage(” & Chr$(34) _
& strCoverSheet & Chr$(34) & “)”
DoCmd.OpenReport strDocName, acViewNormal, gstrReportFilter‘Send cover sheet text
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, _
Data:=”fillcoverpage(” & Chr$(34) _
& strBody & Chr$(34) & “)”‘Show send screen
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, _
Data:=”showsendscreen(” & Chr$(34) _
& “0” & Chr$(34) & “)”‘Set resolution
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, _
Data:=”resolution(” & Chr$(34) _
& “HIGH” & Chr$(34) & “)”‘Send the fax
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, Data:=”SendfaxUI”
DDETerminate ChanNum:=lngChannel
lngChannel = DDEInitiate(Application:=”FAXMNG32″, topic:=”CONTROL”)
DDEExecute ChanNum:=lngChannel, Command:=”GoActive”
DDETerminate ChanNum:=lngChannel
End IfErrorHandlerExit:
DoCmd.Close objecttype:=acForm, objectname:=Me.Name
Exit SubErrorHandler:
MsgBox “Error No: ” & Err.Number & “; Description: ” & _
Err.Description
Resume ErrorHandlerExit -
AuthorPosts
- You must be logged in to reply to this topic.