DDE from access to winfax 8.0

Posted on 1998-02-16
Last Modified: 2012-08-14
I have been able to automate the process of faxing using fields within VB5.0 going thru winfax8.0 but I need to be able to do it thru access95. If anyone has some code which might help it would be appreciated. I used the sample code that came with winfax8.0 to automate the process within VB5.0 but the same code will not work in access.
The code used with VB is as follows:

Sub Command1_Click ()

FAXNumber$ = "555-1212"
SendTime$ = "06:00:00"
SendDate$ = "12/25/96"
FAXName$ = "Benjamin Smith"
Company$ = "Data Processing Services"
Subject$ = "Joy of Faxing"
Keyword$ = "fax, joy"
BillingCode$ = "5905-001-xx"
Mode$ = "Fax"
CoverText$ = "Do enjoy this seasonal message."
'This is the start of the DDE to WinFax.
'Create the link and disable
'automatic reception in WinFax.
Label1.LinkTopic = "FAXMNG32|CONTROL"
Label1.LinkMode = 2
Label1.LinkTimeout = -1
Label1.LinkExecute "GoIdle"
Label1.LinkMode = 0
'Create a new link with the TRANSMIT topic.
Label1.LinkTopic = "FAXMNG32|TRANSMIT"
Label1.LinkMode = 2
Label1.LinkTimeout = -1
Label1.LinkItem = "sendfax"
'Start DDEPokes to control WinFax.
recip$ = "recipient(" & Chr$(34) & FAXNumber$ & Chr$(34) & "," & Chr$(34) & SendTime$ & Chr$(34) & "," & Chr$(34) & SendDate$ & Chr$(34) & ","
recip$ = recip$ & Chr$(34) & FAXName$ & Chr$(34) & "," & Chr$(34) & Company$ & Chr$(34) & "," & Chr$(34) & Subject$ & Chr$(34) & ","
recip$ = recip$ & Chr$(34) & Keyword$ & Chr$(34) & "," & Chr$(34) & BillingCode$ & Chr$(34) & "," & Chr$(34) & Mode$ & Chr$(34) & ")"
Label1.Caption = recip$
Label1.Caption = "setcoverpage(" & Chr$(34) & CoverPage$ & Chr$(34) & ")"
Label1.Caption = "fillcoverpage(" & Chr$(34) & CoverText$ & Chr$(34) & ")"
Label1.Caption = "attach(" & Chr$(34) & Attachment$ & Chr$(34) & ")"
Label1.Caption = "showsendscreen(""1"")"
Label1.Caption = "resolution(""HIGH"")"
'The SendfaxUI parameter is used only
'when a fax-ready cover page and/or
'attachments are included and you do
‘not need to print to the WinFax printer
Label1.Caption = "SendfaxUI"
'Send the fax.
Label1.LinkTopic = "FAXMNG32|CONTROL"
Label1.LinkMode = 2
Label1.LinkTimeout = -1
Label1.LinkExecute "GoActive"
'Close the link between the applications.
Label1.LinkMode = 0
End Sub

All comments that were in the original helpfile with winfax8.0 have been left in. This works also if you make the fixed settings variables. I just need to be able to get it to work in Access95.
Question by:bobpaton
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 12

Expert Comment

ID: 1968500
Provide the code, if it is not to long, so we can have a look at it. Also include any error messages og symptoms other than the fact that it is not working.

Author Comment

ID: 1968501
Edited text of question

Author Comment

ID: 1968502
Adjusted points to 150

Accepted Solution

IanHinson earned 150 total points
ID: 1968503
Here's some example code for sending a report by fax using WinFax in Access 95/97.

The report should be set up to use the WinFax printer (Delrina MAPI Services?) in its Page Setup in design mode.

The code assumes that WinFax has already been started. This is checked for by the FindWindow function. Maybe code should be included to start up WinFax automatically (using the Shell() function).

Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal IpClassName As String, ByVal IpWindowName As String)

Function SendWinFax(strFaxName As String, strFaxNumber As String, strReportName As String) As Integer
Dim lngChannelNumber As Long
Dim strFaxStatus As String
Dim FaxTime As String
Dim strRecipFaxNum As String
Dim strRecipTime As String
Dim strRecipDate As String
Dim strRecipName As String
Dim strRecipient As String

On Error GoTo SendWinFax_Error 'Error Trap

If FindWindow("Sfaxmng", "Delrina Winfax PRO") > 0 Then

' Build Recipient string to send in DDEPoke
strRecipFaxNum = Chr$(34) & strFaxNumber & Chr$(34)
strRecipTime = Chr$(34) & Format$(Now, "h:nn:ss") & Chr$(34)
strRecipDate = Chr$(34) & Date & Chr$(34)
strRecipName = Chr$(34) & Left$(strFaxName, 24) & Chr$(34)
strRecipient = strRecipFaxNum & "," & strRecipTime & "," & strRecipDate & "," & strRecipName

lngChannelNumber = DDEInitiate("faxmng32", "CONTROL")
strFaxStatus = DDERequest(lngChannelNumber, "STATUS")

'If busy then loop until not busy
While strFaxStatus Like "Busy*"
  strFaxStatus = DDERequest(lngChannelNumber, "STATUS")

lngChannelNumber = DDEInitiate("FAXMNG", "TRANSMIT")
DDEPoke lngChannelNumber, "Sendfax", "recipient(" & strRecipient & ")"
DDEPoke lngChannelNumber, "Sendfax", "showsendscreen(""0"")"
'DDEPoke lngChannelNumber, "Sendfax", "setcoverpage(""Cover Page"" )" 'Untested Other Poke examples
'DDEPoke lngChannelNumber, "Sendfax ", "fillcoverpage(""Stuff to go inside."")"
'DDEPoke lngChannelNumber, "SendFax", "resolution(""HIGH"")"

' Run the Report
DoCmd.OpenReport strReportName, A_NORMAL
SendWinFax = -1 ' setting return value to True
Else 'If WinFax is not started
 MsgBox "Please Start WinFax and try again" 'Prompt
 SendWinFax = 0 ' setting return value to False
End If

 DDETerminateAll 'Terminate all links.
 lngChannelNumber = False
Exit Function

MsgBox "Error:" + Error$, 0, "SendFaxl"
Resume SendFax_Exit

End Function

Hope this helps.


Author Comment

ID: 1968504
Most of it worked, I was able to debug a couple of the areas that didn't work but thanks for the help it is much appreciated

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question