先安装WinFax10
Function Transfer_Report_To_Winfax(p_DBHandle As Database, _
                                    p_HoldMode As Variant, _
                                    p_CountryCode As Variant, _
                                    p_AreaCode As Variant, _
                                    p_LocalFaxNo As Variant, _
                                    p_PersonInCharge As Variant, _
                                    p_VendorName As Variant, _
                                    p_SubjectTitle As Variant)
    Dim order_handle As Recordset    Dim sql_b As String
    Dim report_name As String    Dim vendor_count As Double
    Dim objWFXSend As Object
'
    On Error GoTo L_Tansfer_Report_err
   
    sql_b = "SELECT count(*) AS [vendor_count] FROM " & TBL_NAME_ORDER_B & " WHERE (TransactionType not in ('CM','SP','EB') or TransactionType = null ) and Firmness = 'F' AND PRT_FLG = '1' AND Category = 'R' AND CancelReason = '0' AND " & "VENDOR = '" & Vendor_Code & "';"
    report_name = "_Purchase_Order_Regular_Fax"    Set order_handle = p_DBHandle.OpenRecordset(sql_b, DB_OPEN_SNAPSHOT)
    If order_handle.[vendor_count] <> 0 Then
        
        Set objWFXSend = CreateObject("WinFax.SDKSend")
                
        With objWFXSend
            'Add 1 or more Recipients
            .SetHold (p_HoldMode)
            .SetCountryCode (p_CountryCode)
            .SetAreaCode (p_AreaCode)
            .SetNumber (p_LocalFaxNo)
            .SetTo (p_PersonInCharge)
            .SetCompany (p_VendorName)
            .AddRecipient  ' You Can Add Multiple Recipients
                    
            'Cover Page
            .SetSubject (p_SubjectTitle)
            .SetCoverFile ("C:\Program Files\WinFax\COVER\Test.CVP") 'If a CVP (Cover Page) file is previded - your Cover page will print
            '.SetCoverText ("Warning: Those orders are only for AutoFax Test!!!") 'If this line is sent without 'SetCoverFile' a quick Cover page is sent.
             .SetCoverText ("Please Return all copies of this attachment with your signature and your acceptance to each orders within 2 days from receipt of those order sheets. Regards.")
            '1= shows progress screen  0= does not Show screen (1 default)
            .ShowCallProgess (0)  '<---- Notice the 'r' missing this works in WinFax 8 & 9
            '.ShowCallProgress (me.grpProgressScreen)'<---- Works only in WinFax9
                    
            .SetPrintFromApp (1)
            .Send (1)
            .ShowSendScreen (0)
            
            Do While objWFXSend.IsReadyToPrint = 0
                DoEvents
            Loop
            
            DoCmd.SetWarnings (False)
            DoCmd.OpenReport "" & SystemID & report_name, acViewNormal
            DoCmd.SetWarnings (True)
        
            SleepAPI 1000
            .done
            SleepAPI 1000
                    
        End With
                    
'        Do While objWFXSend.IsEntryIDReady(0) <> 1
'            DoEvents
'        Loop
        
        objWFXSend.LeaveRunning ' If we started WinFax with 'Dim objWFXSend As New wfxctl32.CSDKSend' this will leave it running.
        Set objWFXSend = Nothing
        Me.Fax_Count = Me.Fax_Count + 1
                        
                        
    End If
     
    order_handle.Close
    Exit FunctionL_Tansfer_Report_err:
   MsgBox Err.Description
   
   MsgBox "There are some trobles in your program [Transfer_Report_To_WinFax]"
   DoCmd.Quit
'
End Function