Here is the code :
Private Sub CmdFax_Click()
Dim objFaxDocument As Object
Dim objFaxServer As Object
Dim objSender As Object
Dim JobID As Variant
'Error handling
On Error GoTo Error_Handler
LB.Clear
Set objFaxServer = CreateObject("FaxServer.FaxServer.1")
LB.AddItem ("OK <-- CreateObject Server")
'Connect to the fax server
objFaxServer.Connect "srvdev"
LB.AddItem ("OK <-- Server Connect")
Set objFaxDocument = objFaxServer.CreateDocument("c:\testfax.txt")
LB.AddItem ("OK <-- CreateDocument")
'Set the fax body
objFaxDocument.FileName = "c:\testfax.txt"
LB.AddItem ("OK <-- Filename")
'Name the document
objFaxDocument.DisplayName = "My First Fax"
objFaxDocument.FaxNumber = "123"
LB.AddItem ("OK <-- DisplayName and FaxNumber")
'Submit the document to the connected fax server
'and get back the job ID.
JobID = objFaxDocument.Send()
LB.AddItem ("OK <-- Send")
MsgBox "The Job ID is :" & JobID
objFaxServer.Disconnect
Set objFaxServer = Nothing
Set objFaxDocument = Nothing
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
Set objFaxServer = Nothing
Set objFaxDocument = Nothing
End Sub