I am running Windows Server 2008 R2. I installed the fax server role on the server. I am able to fax documents using the external fax modem attached to the server from computers attached to the network by printing the documents and selecting "Fax on MYSERVER". I am able to fax a .pdf using the following code (which I got from mdsn.microsoft.com) from the server but not from any other computer even when logged into the computer using the administrator account.
Sub fax_report(location_fax_number, report_name, fax_location, fax_file_path)
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim JobID As Object
On Error GoTo Err_Clear
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
'Connect to the fax server
objFaxServer.Connect ("\\MYSERVER")
'Set the fax body
objFaxDocument.Body = fax_file_path
'Name the document
objFaxDocument.DocumentName = report_name
objFaxDocument.Recipients.add (location_fax_number)
JobID = objFaxDocument.ConnectedSubmit(objFaxServer)
objFaxServer.Disconnect
End Sub
The error I'm getting is:
- Description: "Operation failed"
- HelpContext: 1000440
- HelpFile: "C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA7.1\1033\VbLR6.chm"
- LastDllError: 0
- Number: -2147023741
- Source: "FaxComEx.FaxDocument.1"
Although I am able to fax a .pdf from the server when I try from a computer on the network it fails. I am able to send a .txt file fro a computer on the network. It looks like the .pdf isn't automatically being converted to a .tiff file like it is when I run the code on the server. When I run the code from the server Adobe Acrobat Reader DC opens, the .pdf is opened and converted then faxed without error. Adobe stays open and I can see a temp file was created, it isn't available to be opened from the recent file lists menu.