Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    130

    Unanswered: Faxing from A2K2 and WinXPPro

    I am trying to fax a document using syntax from a number of MS KB articles. The VBA is as follows:

    Function FaxReport(strReportToFax As String, strFaxNo As String)
    Dim db As DAO.Database
    Dim strFaxOutput As String
    strFaxOutput = "[fax: " & strFaxNo & "]"
    DoCmd.SendObject acReport, strReportToFax, acFormatRTF, strFaxOutput, , , , , False
    End Function

    What happens is that it sends the report to Outlook. The specific printer for this report is a Fax Printer. I have added the MS Fax References to my vba.
    Anyone know what I'm doing wrong?
    thanks,
    Winston

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Found this bit of code...Never tried it though:


    Code:
     
    The following code demostrates how to send a fax using Microsoft Outlook.
    
    'Purpose	 :  Sends a fax using Outlook and Microsoft Fax
    'Inputs	  :  sFaxNumber				  The fax number to send the fax to.
    '			   sSubject					The fax subject.
    '			   sBody					   The fax body.
    '			   [sFileName]				 The file to fax.
    'Outputs	 :  Returns an empty string on success, else returns an error description
    'Author	  :  Andrew Baker
    'Date		:  09/03/2001 14:32
    'Notes	   :  Will return a "System Adminstrator" undeliverable message if you do not have
    '			   Microsoft Fax installed.
    'Revisions   :
    
    Function OutlookSendFax(sFaxNumber As String, sSubject As String, sBody As String, Optional sFileName As String) As String
    	Dim oOutlook As Object	  'Outlook.Application
    	Dim oFax As Object		  'Outlook.MailItem
    	
    	On Error GoTo ErrFailed
    	Set oOutlook = CreateObject("Outlook.Application")
    	Set oFax = oOutlook.CreateItem(0)	   'olMailItem
    	With oFax
    		.To = "[Fax:" & sFaxNumber & "]"
    		.Subject = sSubject
    		.Body = sBody
    		If Len(sFileName) Then
    			If Len(Dir$(sFileName)) Then
    				'Add attachment
    				.Attachments.Add sFileName
    			End If
    		End If
    		.Send
    	End With
    	
    	Set oFax = Nothing
    	Set oOutlook = Nothing
    	
    	OutlookSendFax = ""	 'Return success
    	Exit Function
    
    ErrFailed:
    	'Failed, return error description
    	OutlookSendFax = "Error in OutlookSendFax: " & Err.Description
    End Function
    
    'Demonstration routine
    Sub Test()
    	OutlookSendFax "020 7773 1994", "TEST SUBJECT", "TEST BODY", "c:\myfile.doc"
    End Sub
    hope it helps......


  3. #3
    Join Date
    Apr 2004
    Posts
    130
    Thank you. I eventually got it to work. Need to set up a fax mail transport account in Outlook. Then it works like a charm.
    thanks again.
    Winston

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •