Solved

DDE from access to winfax 8.0

Posted on 1998-02-16
5
330 Views
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"
CoverPage$ = "C:\DATA\WINFAX\COVERS\GENERAL.CVP"
CoverText$ = "Do enjoy this seasonal message."
Attachment$ = "C:\DATA\OTHER\XMASTREE.FXR"
'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.LinkPoke
'setcoverpage
Label1.Caption = "setcoverpage(" & Chr$(34) & CoverPage$ & Chr$(34) & ")"
Label1.LinkPoke
'fillcoverpage
Label1.Caption = "fillcoverpage(" & Chr$(34) & CoverText$ & Chr$(34) & ")"
Label1.LinkPoke
'attach
Label1.Caption = "attach(" & Chr$(34) & Attachment$ & Chr$(34) & ")"
Label1.LinkPoke
'showsendscreen
Label1.Caption = "showsendscreen(""1"")"
Label1.LinkPoke
'resolution
Label1.Caption = "resolution(""HIGH"")"
Label1.LinkPoke
'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
‘driver.
Label1.Caption = "SendfaxUI"
Label1.LinkPoke
'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.
0
Comment
Question by:bobpaton
  • 3
5 Comments
 
LVL 12

Expert Comment

by:Trygve
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.
0
 

Author Comment

by:bobpaton
ID: 1968501
Edited text of question
0
 

Author Comment

by:bobpaton
ID: 1968502
Adjusted points to 150
0
 
LVL 1

Accepted Solution

by:
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")
Wend

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

SendFax_Exit:
 DDETerminateAll 'Terminate all links.
 lngChannelNumber = False
Exit Function

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

End Function

Hope this helps.

0
 

Author Comment

by:bobpaton
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
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now