|
|
Question : SEND AN EXCEL SHEET BY FAX USING VB
|
|
I tried to use winfax 9 pro do send a fax from excel using DDE in a VB code .
I recieve the massage "ACTIVEX COMPONENT CANNOT CREATE OBJECT" and the code line was "CN=APPLICTION.DDEINITIATE("FAXMNG","TRANSMIT") I am using win2k with Winfax Pro .
Can you think of why winfax fas not started ??
OR
Can you give me an alternative way AND A WORKING WAY to send a worksheet to fax ?
A code sample is needed .
Thanks
Dani K
|
Answer : SEND AN EXCEL SHEET BY FAX USING VB
|
|
coincidence??
http://www.woodyswatch.com/access/archtemplate.asp?current
read the part on faxing from Hellen Feddema
she is using this code in part 2 which you get when subscribing i guess
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
'Test for required fields
strFax = Me![txtToFax].Value
If strFax = "" Then
MsgBox "Please enter a fax number"
GoTo ErrorHandlerExit
End If
Debug.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 If
If 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 & "COVER\BASIC1.CVP"
Debug.Print "Cover sheet: " & strCoverSheet
'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) & ")"
'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 If
ErrorHandlerExit:
DoCmd.Close objecttype:=acForm, objectname:=Me.Name
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit
End Sub
look at the line
lngChannel = DDEInitiate("FAXMNG32", "TRANSMIT")
we used
lngChannel = DDEInitiate("FAXMNG", "TRANSMIT")
before could that be the issue here?
|
|
|
|
|