by Dave Buckner (2 Submissions)
Category: OLE/COM/DCOM/Active-X
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (9 Votes)
With this snippet you can fax from any windows 2000 and windows XP box with Fax Services! The only other way to share a fax otherwise is Small Business server. All feedback is welcome!
Assumes
Make a reference to Fax COM Type lib 1.0
Private Sub Form_Load()
On Error GoTo ErrHandler
Dim strComputer As String
strComputer = "yourComputerName"
Dim oFaxServer As FAXCOMLib.FaxServer
Set oFaxServer = New FAXCOMLib.FaxServer
Dim oFaxDoc As FAXCOMLib.FaxDoc
oFaxServer.Connect strComputer
oFaxServer.ServerCoverpage = 0
Set oFaxDoc = oFaxServer.CreateDocument(App.Path & "\" & "New Text Document.txt")
With oFaxDoc
.FaxNumber = "5551212"
.DisplayName = "Fax Server"
Dim lngSend As Long
lngSend = .Send
End With
Set oFaxDoc = Nothing
oFaxServer.Disconnect
Set oFaxServer = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Number & " " & Err.Description
End Sub