- This topic is empty.
-
AuthorPosts
-
June 23, 2005 at 5:40 pm #2736AnonymousMember
Hi,
I am using a DDE code to attach a word document to a Fax in WinFax from MS Access 2000. I have the code in a form and in a command button. This all works fine in Windows XP. No problems at all, but when I try the same database with the same code in the command button, I get the following:
WinFax cannot send the binary file
filename.doc
as a WinFax image because the program needed to print this file cannot be found. Do you want to omit all recipients from the event?Thanks for any help.
June 23, 2005 at 5:57 pm #4683AnonymousMembercan you post the code you are using?
the error usually means that WinFax cannot find “winword” or another associated program that can print “.doc” files on the system. Can you successfully right-click a “.doc” file in Explorer, and select Print?
June 23, 2005 at 6:57 pm #4684AnonymousMemberThank you for your help,
I can make it work with “Snapshot” format which is what I want to use anyway because images and such.
So it does work now but, is there a way that I can just attach the report itself which resides in the database intead of having to output it as a windows file path? I have the code below. If you scroll down, there is a “attach= ??????” section. Here is my code:
Private Sub cmdSendFax_Click()
On Error GoTo ErrorHandler
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 strMessageSubject As String
Dim strTitle As String
Dim strPrompt As String
Dim strWinFaxDir As String
Dim strBody As String
Dim strattach As String‘Test for required fields
strFax = Me![txtToFax].Value
If strFax = “” Then
MsgBox “Please enter a fax number”
GoTo ErrorHandlerExit
End IfDebug.Print “Fax: ” & strFax
strMessageSubject = Me![txtMessageSubject].Value
strBody = Me![txtBody].Value
If strBody = “” Then
MsgBox “Please enter the fax text”
Me![txtBody].SetFocus
GoTo ErrorHandlerExit
End IfIf IsDate(Me![txtFaxDate].Value) = False Then
MsgBox “Please enter a send date”
Me![txtFaxDate].SetFocus
GoTo ErrorHandlerExit
Else
dteFax = Me![txtFaxDate].Value
End If‘Send fax
If strFax <> “” Then
strCustomerName = Nz(Me![txtCustomerName])
strCompany = Nz(Me![txtCompanyName])
If dteFax = Date Then
strSendTime = Format(Now(), “hh:mm:ss”)
Else
strSendTime = “08:00:00”
End If
strSendDate = Format(dteFax, “mm/dd/yy”)strCoverSheet = WinFaxDir & “COVERBASIC1.CVP”
Debug.Print “Cover sheet: ” & strCoverSheetstrattach = “Report.Table1.snp”
Debug.Print “Attachment: ” & strattach‘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) & “)”‘Specify attach
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, _
Data:=”attach(” & Chr$(34) _
& strattach & Chr$(34) & “)”‘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 ErrorHandlerExitEnd Sub
June 23, 2005 at 10:44 pm #4685AnonymousMemberyou want to print the report instead, you have to make sure WinFax is set to the current printer and then print the document to the printer driver. Make sure you don’t use SendFaxUI, as this is not used when using the WinFax PRO printer driver. You won’t need this code when using the Printer Driver to generate a fax image
‘Send the fax
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, Data:=”SendfaxUI”
DDETerminate ChanNum:=lngChannelAlso you would remove the code related to the attachment, since you are generating the fax image via the WinFax PRO printer driver.
Edited By Moderator on June 23 2005 at 18:49
June 23, 2005 at 11:37 pm #4686AnonymousMemberOK,
Now I just a command button in a MS Access Form, and all I want to do is use WinFax to fax the specified Report to the Fax Number in the marked text field. This works fine.
If print to the printer driver, can I still make it work in this setup code? Such as use WinFax to send the report?
Here is what I am using now:
Private Sub Command2_Click()
On Error GoTo ErrorHandlerDim strRecipient As String
Dim strFax As String
Dim strattach As String‘Test for required fields
strFax = Me![txtToFax].Value
If strFax = “” Then
MsgBox “Please enter a fax number”
GoTo ErrorHandlerExit
End IfDebug.Print “Fax: ” & strFax
strattach = “E:Documents and SettingsAdministratorDesktoptblContacts.snp”
Debug.Print “Attachment: ” & strattach‘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) & “)”
Debug.Print “Recipient string: ” & strRecipient
Debug.Print “Length of recipient string: ” & Len(strRecipient)
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, Data:=strRecipient‘Specify attach
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, _
Data:=”attach(” & Chr$(34) _
& strattach & 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:=lngChannelErrorHandlerExit:
DoCmd.Close objecttype:=acForm, objectname:=Me.Name
Exit SubErrorHandler:
MsgBox “Error No: ” & Err.Number & “; Description: ” & _
Err.Description
Resume ErrorHandlerExitEnd Sub
June 24, 2005 at 1:33 pm #4687AnonymousMemberSomething like the following should work:
Private Sub Command2_Click()
On Error GoTo ErrorHandlerDim strRecipient As String
Dim strFax As String
Dim strattach As String‘Test for required fields
strFax = Me![txtToFax].Value
If strFax = “” Then
MsgBox “Please enter a fax number”
GoTo ErrorHandlerExit
End IfDebug.Print “Fax: ” & strFax
strattach = “E:Documents and SettingsAdministratorDesktoptblContacts.snp”
Debug.Print “Attachment: ” & strattach‘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) & “)”
Debug.Print “Recipient string: ” & strRecipient
Debug.Print “Length of recipient string: ” & Len(strRecipient)
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, Data:=strRecipient‘Specify attach
DDEPoke ChanNum:=lngChannel, Item:=”sendfax”, _
Data:=”attach(” & Chr$(34) _
& strattach & 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) & “)”
‘
‘
‘
‘ code to switch the printer driver to winfax “WinFax on FaxModem” goes here
‘ code to print the current document to the current printer
‘ some delay to allow printing.
‘ and you might want to add code to switch
‘ back to the original printer driver.
‘
lngChannel = DDEInitiate(Application:=”FAXMNG32″, topic:=”CONTROL”)
DDEExecute ChanNum:=lngChannel, Command:=”GoActive”
DDETerminate ChanNum:=lngChannelErrorHandlerExit:
DoCmd.Close objecttype:=acForm, objectname:=Me.Name
Exit SubErrorHandler:
MsgBox “Error No: ” & Err.Number & “; Description: ” & _
Err.Description
Resume ErrorHandlerExitEnd Sub
-
AuthorPosts
- You must be logged in to reply to this topic.