markmchugh
asked on
winfax API
I have winfax pro 10, and i have installed it on my server. I can send faxes fine. I have installed winfax on my client machines, and again i can send faxes through winfax perfectly. I now want to send faxes from with my visual basic application, has anybody got an example of how to do this?
thanls
thanls
Does winfax expose COM object modal representing its interfaces. Do you know the dll's, ocx's involved. in vb look at the references dialog and see if anything has a similar name as winfax. If you see reference it and check what properties methods are available via the intellisense
I got write a function to send faxes using WinFax Pro 10.0 for Access VBA about 1 year again, try amend it and see if this makes help?
'For your information, you need to add "Winfax Automation Server" from References
Public Function SendFaxWithRpt(ByVal strFullName As String, _
ByVal strNumber As String, _
ByVal strSubject As String, _
ByVal strReport As String, _
Optional ByVal UseCover As Boolean = True, _
Optional ByVal CoverMsg As String, _
Optional ByVal AttachList As String = "", _
Optional ByVal ShowCallProgess As Boolean = True _
) As Boolean
Dim ret As Integer
Dim sendObj As Object
'Dim sendObj As CSDKSend
' initialize objects
Set sendObj = CreateObject("WinFax.SDKSe nd")
' set Preview, Billing & Keywords settings
sendObj.SetPreviewFax 0
sendObj.EnableBillingCodeK eyWords 0
'If chkEnableBillingCodeKeyWor ds.Value = 1 Then
' sendObj.SetBillingCode "edtBillingCode"
' sendObj.SetKeywords "edtKeyWords"
'End If
' set cover page settings
If UseCover Then
sendObj.SetUseCover (1)
'If chkUseQuickCoverPage.Value = 1 Then
sendObj.SetQuickCover (1)
'Else
' sendObj.SetQuickCover (0)
' If chkUseFileName.Value = 1 Then
' sendObj.SetCoverFile "Filename"
' Else
' sendObj.SetCoverPage (lstCoverPages.ListIndex + 1)
' End If
'End If
sendObj.SetCoverText CoverMsg
Else
sendObj.SetUseCover (0)
End If
' Add a recipient
sendObj.SetAreaCode ""
sendObj.SetCountryCode ""
sendObj.SetDialPrefix ""
sendObj.SetNumber strNumber
sendObj.SetExtension ""
sendObj.SetTo strFullName
'If chkOnHold.Value = 1 Then
' sendObj.SetHold (0)
'ElseIf chkOffPeak.Value = 1 Then
' sendObj.SetOffPeak (0)
'ElseIf chkSendOn.Value = 1 Then
' sendObj.SetTime Format$(Now(), "HH:MM:SS")
' sendObj.SetDate Format$(Now(), "MM/DD/YY")
'End If
sendObj.SetTime Format$(Now(), "HH:MM:SS")
sendObj.SetDate Format$(Now(), "MM/DD/YY")
'If chkSetTypeByName.Value = 0 Then
' sendObj.SetType (0) 'can be many values
'Else
' sendObj.SetTypeByName (Mid$(lstType.List(lstType s.ListInde x), 2))
'End If
sendObj.SetType (0)
If sendObj.AddRecipient() = 1 Then
MsgBox "The Recipient couldn't be added.", vbExclamation
Exit Function
End If
' other settings
sendObj.SetSubject strSubject
sendObj.SetUseCreditCard (0)
sendObj.SetResolution (0)
sendObj.SetUsePrefix (0)
sendObj.SetDeleteAfterSend (0)
sendObj.ShowCallProgess IIf(ShowCallProgess = True, 1, 0)
If strReport <> "" Then
sendObj.SetPrintFromApp (1)
End If
' okay, lets go!
ret = sendObj.Send(0)
If strReport <> "" Then
DoCmd.OpenReport strReport, acViewPreview
DoCmd.PrintOut acPrintAll
DoEvents
DoCmd.Close acReport, strReport, acSaveYes
End If
DoEvents
' destroy and recreate the send object so we can send another fax
Set sendObj = Nothing
' was there an error?
If ret <> 0 Then
MsgBox "There was an Error", vbOKOnly
SendFaxWithRpt = False
Else
'MsgBox "Fax has been sent!", vbInformation
SendFaxWithRpt = True
End If
End Function
Public Function SendFax(ByVal strFullName As String, _
ByVal strNumber As String, _
ByVal strSubject As String, _
Optional ByVal UseCover As Boolean = True, _
Optional ByVal CoverMsg As String, _
Optional ByVal AttachList As String = "", _
Optional ByVal ShowCallProgess As Boolean = True _
) As Boolean
Dim ret As Integer
Dim sendObj As Object
'Dim sendObj As CSDKSend
' initialize objects
Set sendObj = CreateObject("WinFax.SDKSe nd")
' set Preview, Billing & Keywords settings
sendObj.SetPreviewFax 0
sendObj.EnableBillingCodeK eyWords 0
'If chkEnableBillingCodeKeyWor ds.Value = 1 Then
' sendObj.SetBillingCode "edtBillingCode"
' sendObj.SetKeywords "edtKeyWords"
'End If
' set cover page settings
If UseCover Then
sendObj.SetUseCover (1)
'If chkUseQuickCoverPage.Value = 1 Then
sendObj.SetQuickCover (1)
'Else
' sendObj.SetQuickCover (0)
' If chkUseFileName.Value = 1 Then
' sendObj.SetCoverFile "Filename"
' Else
' sendObj.SetCoverPage (lstCoverPages.ListIndex + 1)
' End If
'End If
sendObj.SetCoverText CoverMsg
Else
sendObj.SetUseCover (0)
End If
' Add a recipient
sendObj.SetAreaCode ""
sendObj.SetCountryCode ""
sendObj.SetDialPrefix ""
sendObj.SetNumber strNumber
sendObj.SetExtension ""
sendObj.SetTo strFullName
'If chkOnHold.Value = 1 Then
' sendObj.SetHold (0)
'ElseIf chkOffPeak.Value = 1 Then
' sendObj.SetOffPeak (0)
'ElseIf chkSendOn.Value = 1 Then
' sendObj.SetTime Format$(Now(), "HH:MM:SS")
' sendObj.SetDate Format$(Now(), "MM/DD/YY")
'End If
sendObj.SetTime Format$(Now(), "HH:MM:SS")
sendObj.SetDate Format$(Now(), "MM/DD/YY")
'If chkSetTypeByName.Value = 0 Then
' sendObj.SetType (0) 'can be many values
'Else
' sendObj.SetTypeByName (Mid$(lstType.List(lstType s.ListInde x), 2))
'End If
sendObj.SetType (0)
If sendObj.AddRecipient() = 1 Then
MsgBox "The Recipient couldn't be added.", vbExclamation
Exit Function
End If
' other settings
sendObj.SetSubject strSubject
sendObj.SetUseCreditCard (0)
sendObj.SetResolution (0)
sendObj.SetUsePrefix (0)
sendObj.SetDeleteAfterSend (0)
sendObj.ShowCallProgess IIf(ShowCallProgess = True, 1, 0)
' okay, lets go!
ret = sendObj.Send(0)
' destroy and recreate the send object so we can send another fax
Set sendObj = Nothing
' was there an error?
If ret <> 0 Then
MsgBox "There was an Error", vbOKOnly
SendFax = False
Else
'MsgBox "Fax has been sent!", vbInformation
SendFax = True
End If
End Function
Some other info that may be useful:
[VB - Send Fax]
http://www.freevbcode.com/ShowCode.ASP?SearchString=fax&ID=2402
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fax/faxportal_9nol.asp
http://www.absolutelydiverse.com.au/vb_tips/hardcore/tip_3.htm
Faxing from Microsoft Access to Winfax Pro and more: (some links may be broken)
ftp://ftp.symantec.com/public/english_us_canada/products/talkworks2/sdk_shared_files/vbawinfax.txt
ftp://ftp.symantec.com/public/english_us_canada/products/talkworks2/sdk_shared_files/wordwfx.txt
http://www.granite.ab.ca/accswfxp.htm
http://www.transcom.de/whfc/doku/InsGM2HylaFax.txt
http://www.symantec.com/techsupp/files/winfax/winfaxsdk-9598nt.html
http://fox.wikis.com/wc.dll?Wiki~WinFaxAutomation
Hope this helps, regards
'For your information, you need to add "Winfax Automation Server" from References
Public Function SendFaxWithRpt(ByVal strFullName As String, _
ByVal strNumber As String, _
ByVal strSubject As String, _
ByVal strReport As String, _
Optional ByVal UseCover As Boolean = True, _
Optional ByVal CoverMsg As String, _
Optional ByVal AttachList As String = "", _
Optional ByVal ShowCallProgess As Boolean = True _
) As Boolean
Dim ret As Integer
Dim sendObj As Object
'Dim sendObj As CSDKSend
' initialize objects
Set sendObj = CreateObject("WinFax.SDKSe
' set Preview, Billing & Keywords settings
sendObj.SetPreviewFax 0
sendObj.EnableBillingCodeK
'If chkEnableBillingCodeKeyWor
' sendObj.SetBillingCode "edtBillingCode"
' sendObj.SetKeywords "edtKeyWords"
'End If
' set cover page settings
If UseCover Then
sendObj.SetUseCover (1)
'If chkUseQuickCoverPage.Value
sendObj.SetQuickCover (1)
'Else
' sendObj.SetQuickCover (0)
' If chkUseFileName.Value = 1 Then
' sendObj.SetCoverFile "Filename"
' Else
' sendObj.SetCoverPage (lstCoverPages.ListIndex + 1)
' End If
'End If
sendObj.SetCoverText CoverMsg
Else
sendObj.SetUseCover (0)
End If
' Add a recipient
sendObj.SetAreaCode ""
sendObj.SetCountryCode ""
sendObj.SetDialPrefix ""
sendObj.SetNumber strNumber
sendObj.SetExtension ""
sendObj.SetTo strFullName
'If chkOnHold.Value = 1 Then
' sendObj.SetHold (0)
'ElseIf chkOffPeak.Value = 1 Then
' sendObj.SetOffPeak (0)
'ElseIf chkSendOn.Value = 1 Then
' sendObj.SetTime Format$(Now(), "HH:MM:SS")
' sendObj.SetDate Format$(Now(), "MM/DD/YY")
'End If
sendObj.SetTime Format$(Now(), "HH:MM:SS")
sendObj.SetDate Format$(Now(), "MM/DD/YY")
'If chkSetTypeByName.Value = 0 Then
' sendObj.SetType (0) 'can be many values
'Else
' sendObj.SetTypeByName (Mid$(lstType.List(lstType
'End If
sendObj.SetType (0)
If sendObj.AddRecipient() = 1 Then
MsgBox "The Recipient couldn't be added.", vbExclamation
Exit Function
End If
' other settings
sendObj.SetSubject strSubject
sendObj.SetUseCreditCard (0)
sendObj.SetResolution (0)
sendObj.SetUsePrefix (0)
sendObj.SetDeleteAfterSend
sendObj.ShowCallProgess IIf(ShowCallProgess = True, 1, 0)
If strReport <> "" Then
sendObj.SetPrintFromApp (1)
End If
' okay, lets go!
ret = sendObj.Send(0)
If strReport <> "" Then
DoCmd.OpenReport strReport, acViewPreview
DoCmd.PrintOut acPrintAll
DoEvents
DoCmd.Close acReport, strReport, acSaveYes
End If
DoEvents
' destroy and recreate the send object so we can send another fax
Set sendObj = Nothing
' was there an error?
If ret <> 0 Then
MsgBox "There was an Error", vbOKOnly
SendFaxWithRpt = False
Else
'MsgBox "Fax has been sent!", vbInformation
SendFaxWithRpt = True
End If
End Function
Public Function SendFax(ByVal strFullName As String, _
ByVal strNumber As String, _
ByVal strSubject As String, _
Optional ByVal UseCover As Boolean = True, _
Optional ByVal CoverMsg As String, _
Optional ByVal AttachList As String = "", _
Optional ByVal ShowCallProgess As Boolean = True _
) As Boolean
Dim ret As Integer
Dim sendObj As Object
'Dim sendObj As CSDKSend
' initialize objects
Set sendObj = CreateObject("WinFax.SDKSe
' set Preview, Billing & Keywords settings
sendObj.SetPreviewFax 0
sendObj.EnableBillingCodeK
'If chkEnableBillingCodeKeyWor
' sendObj.SetBillingCode "edtBillingCode"
' sendObj.SetKeywords "edtKeyWords"
'End If
' set cover page settings
If UseCover Then
sendObj.SetUseCover (1)
'If chkUseQuickCoverPage.Value
sendObj.SetQuickCover (1)
'Else
' sendObj.SetQuickCover (0)
' If chkUseFileName.Value = 1 Then
' sendObj.SetCoverFile "Filename"
' Else
' sendObj.SetCoverPage (lstCoverPages.ListIndex + 1)
' End If
'End If
sendObj.SetCoverText CoverMsg
Else
sendObj.SetUseCover (0)
End If
' Add a recipient
sendObj.SetAreaCode ""
sendObj.SetCountryCode ""
sendObj.SetDialPrefix ""
sendObj.SetNumber strNumber
sendObj.SetExtension ""
sendObj.SetTo strFullName
'If chkOnHold.Value = 1 Then
' sendObj.SetHold (0)
'ElseIf chkOffPeak.Value = 1 Then
' sendObj.SetOffPeak (0)
'ElseIf chkSendOn.Value = 1 Then
' sendObj.SetTime Format$(Now(), "HH:MM:SS")
' sendObj.SetDate Format$(Now(), "MM/DD/YY")
'End If
sendObj.SetTime Format$(Now(), "HH:MM:SS")
sendObj.SetDate Format$(Now(), "MM/DD/YY")
'If chkSetTypeByName.Value = 0 Then
' sendObj.SetType (0) 'can be many values
'Else
' sendObj.SetTypeByName (Mid$(lstType.List(lstType
'End If
sendObj.SetType (0)
If sendObj.AddRecipient() = 1 Then
MsgBox "The Recipient couldn't be added.", vbExclamation
Exit Function
End If
' other settings
sendObj.SetSubject strSubject
sendObj.SetUseCreditCard (0)
sendObj.SetResolution (0)
sendObj.SetUsePrefix (0)
sendObj.SetDeleteAfterSend
sendObj.ShowCallProgess IIf(ShowCallProgess = True, 1, 0)
' okay, lets go!
ret = sendObj.Send(0)
' destroy and recreate the send object so we can send another fax
Set sendObj = Nothing
' was there an error?
If ret <> 0 Then
MsgBox "There was an Error", vbOKOnly
SendFax = False
Else
'MsgBox "Fax has been sent!", vbInformation
SendFax = True
End If
End Function
Some other info that may be useful:
[VB - Send Fax]
http://www.freevbcode.com/ShowCode.ASP?SearchString=fax&ID=2402
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fax/faxportal_9nol.asp
http://www.absolutelydiverse.com.au/vb_tips/hardcore/tip_3.htm
Faxing from Microsoft Access to Winfax Pro and more: (some links may be broken)
ftp://ftp.symantec.com/public/english_us_canada/products/talkworks2/sdk_shared_files/vbawinfax.txt
ftp://ftp.symantec.com/public/english_us_canada/products/talkworks2/sdk_shared_files/wordwfx.txt
http://www.granite.ab.ca/accswfxp.htm
http://www.transcom.de/whfc/doku/InsGM2HylaFax.txt
http://www.symantec.com/techsupp/files/winfax/winfaxsdk-9598nt.html
http://fox.wikis.com/wc.dll?Wiki~WinFaxAutomation
Hope this helps, regards
ASKER
thats for that
at the following line
Set sendObj = CreateObject("WinFax.SDKSe nd")
i get the error message, "activex cant create object"
i have the refernces included , seems strange?
at the following line
Set sendObj = CreateObject("WinFax.SDKSe
i get the error message, "activex cant create object"
i have the refernces included , seems strange?
Have you installed the Winfax Pro on the machine before execute the scripts above? Because i got no problem execute it for this previous project, regards
ASKER
yes, i have installed winfax pro on the machine....... i can open winfax pro and send faxes from it...
That works for me for Winfax Pro 10.0, is your version same as mine? other than that, try check the urls i posted above, as it may provide some useful information to you. regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.