Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating WinFax Pro in VBA

Status
Not open for further replies.

bradles

Technical User
Sep 15, 2002
110
AU
Hi all,

After exhaustive searching for info on this topic, it appears the preferred approach is using early binding to create a new fax message to send.

The Problem:
A new message is created ready for cover page info to be entered, but attempting to add an attachment (which my users will want to do sometimes) causes winfax to lock up, seemingly waiting for the code to finish. Otherwise this code works well without trying to add an attachment after WinFax has started:

Code:
Public Function SendFax(strName As String, strNumber As String, strCompany As String, Optional strSubject As String)
Dim objWFXSend As wfxctl32.CSDKSend
Set objWFXSend = New wfxctl32.CSDKSend
    With objWFXSend
        .SetTo (strName)
        .SetNumber (strNumber)
        .SetCompany (strCompany)
        .AddRecipient
        
        .ShowSendScreen 1 'Needed to preview fax before send.
        .SetSubject (strSubject)
        
        .SetUseCover 0    '0=default coverpage set in WinFax
        .Send (0)
        .Done

    End With
Set objWFXSend = Nothing
End Function

Any ideas would be appreciated.
 
I added .AddAttachmentFile to your code and it worked fine for me, the only thing is that WinFax takes a while to load the attachment files application and then print it to Winfax so you wait a while to see the pages appear.


Regards
Alasdair
 
Thanks for your reply mackers2,

Tried your suggestion along with other objects that are available to wfxctl32.CSDKSend without success. My solution might lie elsewhere as I've had other problems with WinFax and some difficulty installing, so I'll try a fresh install and see what happens.
 
Yep, it worked after a fresh install of WinFax.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top