I am not sure about DDE Poke but I have acheived this through creating the fax object, then selecting the objects I want to attach and send the fax(WinFax > v9). Here is the code below for the object, I am still trying to get the CDSKLog object to work. BTW, when I orginally got the code off another list it didn't work especially the DefaultPrinter code.
' Call SendMSFax("rptGroupCheckInProcedures-Union", strAreaCode, strPhone, intCustID)
'You send the FAX with this code - I have it in a module but I can't remember
'where I got the original from:
'********************************************
Option Compare Database
Option Explicit
Type ljg_Device_Nm
drDeviceName As String
drDriverName As String
drPort As String
End Type
Type ljg_Org_Device_Nm
drDeviceName As String
drDriverName As String
drPort As String
End Type
Dim dr As ljg_Device_Nm
Dim org_dv As ljg_Org_Device_Nm
Dim int_Dflt As Boolean
Dim dr_Device As String
Dim dr_Driver As String
Dim dr_Port As String
Dim strTo As String
Dim strCompany As String
Dim strSubject As String
Dim strMsg As String
Dim strTitle As String
Dim intMBType As Integer
Dim intI As Integer
Public Const cMAx_Size As Integer = 255
Declare Sub SleepAPI Lib "Kernel32" Alias "Sleep" (ByVal MSTime As Long)
Declare Function bc_api_GetProfileString Lib "Kernel32" Alias "GetProfileStringA" (ByVal strAppName As String, ByVal strKeyName As String, ByVal strDefault As String, ByVal strReturned As String, ByVal lngSize As Long) As Long
Declare Function bc_api_WriteProfileString Lib "Kernel32" Alias "WriteProfileStringA" (ByVal strAppName As String, ByVal strKeyName As String, ByVal strValue As String) As Integer
Declare Function bc_api_GetProfileSection Lib "Kernel32" Alias "GetProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Function SendFax(argReportName As String, argAreaCode As String, argPhoneNumber As String, argCustID As Integer, argCountryCode As String, argExtension As String) As Integer
'Error-handler inserted on 11/27/2003 at 11:03 by Henri St.Louis
'Comments/Description:
'------------------
'Modified History:
'-------------------
'27 Nov 03 - Added different object since have MS Fax on dev system not WinFax
'27 Nov 03 - Added Lookup for company name & contact info
'22 Dec 03 - Added Null check for contact info
'22 Dec 03 - Got get default & set default printer working
'6 Jan 04 - Added Country code variable
'8 Jan 04 - Added extension variable
'
On Error GoTo SendFax_Error
Dim strOldPrinter As String, strNewPrinter As String, drv As ljg_Org_Device_Nm
'--------------- Get Defalt Printer info & sav
If ljg_GetDefaultPrinter(drv) Then
org_dv.drDeviceName = drv.drDeviceName ' Store original device name
org_dv.drDriverName = drv.drDriverName ' Store original device driver
org_dv.drPort = drv.drPort ' Store original device port
End If
'Change the defalt printer to WinFax 8.0 / 9 ----------------------------
dr.drDeviceName = "WinFax"
dr.drDriverName = "WinFax"
dr.drPort = "FaxModem" 'PUB:
If Not ljg_SetDefaultPrinter(dr) Then
MsgBox "Unable set Fax to the default printer."
End If
Dim objWFXSend As New wfxctl32.CSDKSend '<--- By using this line you get the pull down list of methods (Called Early Binding)
'Dim objWFXSend As Object '<--- If the above line give you problems use these two lines (Late Binding)
'Set objWFXSend = CreateObject("WinFax.SDKSend"
With objWFXSend
' 1 = hold in winfax; 0 = send now
' removed since not option on dev system .SetHold (0) '<---- Sometime is this is at the bottom of the code things hang up???
'Note if you set the below date - time WinFax Ignores the "SetHold" and sends the fax on the
' Appropriate Date and Time - Note it cannot be past date or Time
'.SetDate ("10/08/98"

'.SetTime ("8:30:00"
'--- To:
.SetExtension (argExtension) 'Extension of fax
.SetCountryCode (argCountryCode) ' Country code of fax
.SetAreaCode (argAreaCode) ' Area code of fax
.SetNumber (argPhoneNumber) ' local number of fax
Dim strCustName As String, strFContact As String, strLContact As String
strCustName = DLookup("[CompanyName]", "[CustomerTbl]", "[CustomerID] = " & argCustID)
strFContact = IIf(IsNull(DLookup("[ContactFirstName]", "[CustomerTbl]", "[CustomerID] = " & argCustID)), "", DLookup("[ContactFirstName]", "[CustomerTbl]", "[CustomerID] = " & argCustID))
strLContact = IIf(IsNull(DLookup("[ContactLastName]", "[CustomerTbl]", "[CustomerID] = " & argCustID)), "", DLookup("[ContactLastName]", "[CustomerTbl]", "[CustomerID] = " & argCustID))
.SetTo (strFContact & " " & strLContact)
.SetCompany (strCustName & ""
'--- Billing code - KeyWords
'Sets the billing code field for the send job. This function returns 1 on
'error, 0 on OK. If this function is not used, WinFax defaults to no
'billing code.
.EnableBillingCodeKeyWords (1) '<-- You need to enable key codes first
' lngBillingcode = lngBillingcode + 22 ' Note you can lookup faxes on BillingCode and/or KeyWords
' You might want a number on the Access Record that is the same as Billing Code
.SetBillingCode (argCustID) '<-- You will need to show Billing code in WinFax folders to see the billing code
'.SetKeywords ("Larry's the Key"

'<-- You will need to show KeyWords in WinFax folders to see the KeyWords
'--- Add Recipient - You can loop through and add multiple recipiants
.AddRecipient
.SetPrintFromApp (1)
'.ShowSendScreen (1) '<------ I'don't understand what this does
'.SetResolution (intResolution) 'The below causes a creptic question to be asked at times - How do we stop that?
.SetDeleteAfterSend (0) '1= Delete fax after sending successfully 0=keep (0 default)
'1= shows progress screen 0= does not Show screen (1 default)
'.ShowCallProgess (1) '<---- Notice the 'r' missing this works in WinFax 8 & 9
.ShowCallProgress (1) '<---- Works only in WinFax9
' Start Faxing
.Send (1) 'Instructs WinFax to start the send process. Entry ID of resulting event
'may be requested using 1, 0 - no entry id requested. This function returns 1 on error, 0 on OK.
Do While .IsReadyToPrint = 0 'Returns 1 if WinFax is ready to accept a new print job. This is to be used when printing through the printer driver.
DoEvents
Loop
'Access97 command ********************
'If Me.GrpRpts = 1 Then
'If Me.GrpRpts = 1 Then 'Access Report
DoCmd.SelectObject acReport, "NextServiceDueRpt", True
'End If
'Excel97 Command ********************
'ActiveSheet.PrintOut
'Word97 command ********************
'ActiveDocument.PrintOut
' .IsEntryIDReady
.GetEntryID (SendFax)
SleepAPI 200 ' Don't remove - tried 50, Send Dialog!
.Done
SleepAPI 200 ' Don't remove - tried 50, Send Dialog!
If .IsError = 1 Then
GoTo SendFax_NotifyUser
End If
End With
objWFXSend.LeaveRunning ' If we started WinFax with 'Dim objWFXSend As New wfxctl32.CSDKSend' this will leave it running.
SendFax_Close:
'--------------- Set back to old default printer
'If Me.GrpRpts = 1 Then 'Access Report
With dr
.drDeviceName = org_dv.drDeviceName
.drDriverName = org_dv.drDriverName
.drPort = org_dv.drPort
End With
If Not ljg_SetDefaultPrinter(dr) Then
MsgBox "Unable to >>reset<< the default printer. Please attempt to do it manually."
End If
SendFax_Exit:
Exit Function
SendFax_NotifyUser:
MsgBox "There was a problem encountered with the SendFax " & _
"Function, please ensure software is working.", _
vbExclamation + vbOKOnly + vbDefaultButton1, "SendFax Function"
GoTo SendFax_Close
SendFax_Error:
MsgBox "Unexpected error - " & Err.Number & " " & Err.Description & vbCrLf & "EVAS_GoodFE - SendFax", vbExclamation
Resume SendFax_Exit
End Function
Function ljg_SetDefaultPrinter(dr As ljg_Device_Nm) As Boolean
'Accepts: ljg_SetDefaultPrinter(dr)
'Purpose: Sets the default printer through Windows API
'Returns: True if successful
On Error GoTo ljg_SetDefaultPrinter_Err
'If Programming_Mode Then On Error GoTo 0
'----
Dim strBuffer As String
'----
'-------- Build up the appropriate string.
strBuffer = dr.drDeviceName & ","
strBuffer = strBuffer & dr.drDriverName & ","
strBuffer = strBuffer & dr.drPort
'----------- Now write that string out to WIN.INI.
ljg_SetDefaultPrinter = (bc_api_WriteProfileString("Windows", _
"Device", strBuffer) <> 0)
'----
'
ljg_SetDefaultPrinter_Done:
Application.Echo True
Exit Function
ljg_SetDefaultPrinter_Err:
MsgBox Err.Description, vbCritical, "Error " & Err
Resume ljg_SetDefaultPrinter_Done
End Function '----------------------------------
Function ljg_GetDefaultPrinter(drv As ljg_Org_Device_Nm) As Boolean
'Accepts: ljg_GetDefaultPrinter(dr)
'Purpose: 1) see if default printer exists
' 2) bring back Device - Driver - Port
'Returns: True/False if default exists
' Device - Driver - Port eq HP LaserJet 4 - HPPCL5MS - Lpt1:
On Error GoTo ljg_GetDefaultPrinter_Err
'If Programming_Mode Then On Error GoTo 0
'----
Dim strBuffer As String
Dim intTmp As Integer
Dim intTmp2 As Integer
Dim intChars As Integer
'---- do api to get default printer
strBuffer = String(cMAx_Size, 0)
intChars = bc_api_GetProfileString("Windows", "Device", "", strBuffer, cMAx_Size)
strBuffer = left(strBuffer, intChars)
If Len(strBuffer) > 0 Then
'------------------ Pull string apart -------------
intTmp = InStr(1, strBuffer, ","

- 1
drv.drDeviceName = Mid(strBuffer, 1, intTmp)
strBuffer = Mid(strBuffer, intTmp + 2)
intTmp = InStr(1, strBuffer, ","

- 1
drv.drDriverName = Mid(strBuffer, 1, intTmp)
drv.drPort = Mid(strBuffer, intTmp + 2)
ljg_GetDefaultPrinter = True
Else
ljg_GetDefaultPrinter = False
End If
'----
'
ljg_GetDefaultPrinter_Done:
Application.Echo True
Exit Function
ljg_GetDefaultPrinter_Err:
MsgBox Err.Description, vbCritical, "Error " & Err
Resume ljg_GetDefaultPrinter_Done
End Function '----------------------------------