here's the code (refer from msdn) that i use for the receive fax function :-
Expand|Select|Wrap|Line Numbers
- Dim objFaxServer As New FAXCOMEXLib.FaxServer
- Dim collFaxIncomingJobs As FaxIncomingJobs
- Dim objFaxIncomingJob As FaxIncomingJob
- 'Error handling
- On Error GoTo Error_Handler
- 'Connect to the fax server
- objFaxServer.Connect "zeus-lap"
- 'Get the collection of jobs in the incoming queue
- Set collFaxIncomingJobs = objFaxServer.Folders.IncomingQueue.GetJobs
- 'Display the number of jobs in the collection
- MsgBox "There are " & collFaxIncomingJobs.Count & " jobs in the incoming queue."
- Dim n As Long
- 'Get the job
- n = InputBox("Input the item number for which you want information.")
- Set objFaxIncomingJob = collFaxIncomingJobs.Item(n)
- 'Refresh the job object (job is in process of being received, you
- 'want current information)
- objFaxIncomingJob.Refresh
- 'Display the job properties
- MsgBox "Available operations: " & objFaxIncomingJob.AvailableOperations & _
- vbCrLf & "Caller ID: " & objFaxIncomingJob.CallerId & _
- vbCrLf & "CSID: " & objFaxIncomingJob.CSID & _
- vbCrLf & "Current page: " & objFaxIncomingJob.CurrentPage & _
- vbCrLf & "Device ID: " & objFaxIncomingJob.DeviceId & _
- vbCrLf & "Extended status: " & objFaxIncomingJob.ExtendedStatus & _
- vbCrLf & "Extended status code : " & objFaxIncomingJob.ExtendedStatusCode & _
- vbCrLf & "Job ID: " & objFaxIncomingJob.Id & _
- vbCrLf & "Job type: " & objFaxIncomingJob.JobType & _
- vbCrLf & "Retries: " & objFaxIncomingJob.Retries & _
- vbCrLf & "Routing information: " & objFaxIncomingJob.RoutingInformation & _
- vbCrLf & "Size: " & objFaxIncomingJob.Size & _
- vbCrLf & "Status: " & objFaxIncomingJob.Status & _
- vbCrLf & "Transmission start: " & objFaxIncomingJob.TransmissionStart & _
- vbCrLf & "Transmission end: " & objFaxIncomingJob.TransmissionEnd & _
- vbCrLf & "TSID: " & objFaxIncomingJob.TSID
- 'Allow user to cancel the selected fax
- Dim CancelString As String
- CancelString = InputBox("Cancel this fax (Y/N)?")
- If CancelString = "Y" Then objFaxIncomingJob.Cancel
- 'Allow user to open the selected fax
- Dim OpenString As String
- OpenString = InputBox("Open this fax (Y/N)?")
- If OpenString = "Y" Then
- Dim FileName As String
- FileName = InputBox("Provide path and name of file for TIFF copy, e.g. c:\MyFax.tiff")
- objFaxIncomingJob.CopyTiff (FileName)
- 'Open the tiff file
- Dim A As Object
- Set A = CreateObject("wscript.shell")
- A.run FileName
- End If
- Exit Sub
- Error_Handler:
- 'Implement error handling at the end of your subroutine. This
- ' implementation is for demonstration purposes
- MsgBox "Error number: " & Hex(Err.Number) & ", " & Err.Description