When you fax a document, the fax service runs a shell
command to search for the document type, and then the fax service calls the
print to verb for that document type. The fax service runs the
print to verb. If the
print to verb succeeds, the fax service generates a Tagged Image File
Format (.tiff) output file for that document.
Steps to reproduce the behavior
- Start Microsoft Visual Basic 6.0. The New
Project dialog box appears.
- On the New tab, click Standard
EXE, and then click Open.
- On the Project menu, click
References.
- In the References - Project1 dialog box,
click Microsoft Fax Service Extended COM Type Library, and
then click OK.
Note You must install Fax Services to add the Microsoft Fax
Service Extended COM Type Library reference. - In the Project - Project1 window,
right-click the Form1.frm form, and then click View
Code.
- In the Project1 - Form1 (Code) window, add
the following code.
Note The SampleHTMLFile placeholder in this
code is for a sample HTML file. The sender and recipient contact information is
fictitious.Private Sub Form_Load()
Dim FaxDocumentObj As New FAXCOMEXLib.FaxDocument
Dim FaxServerObj As New FAXCOMEXLib.FaxServer
Dim JobIDObj As Variant
'Error handling.
On Error GoTo Error_Handler
'Connect to the fax server.
FaxServerObj.Connect ""
'Set the fax body.
FaxDocumentObj.Body = "c:\<SampleHTMLFile>"
'Name the document.
FaxDocumentObj.DocumentName = "First Fax"
'Set the fax priority.
FaxDocumentObj.Priority = fptHIGH
'Add the recipient with the fax number 2065552626.
FaxDocumentObj.Recipients.Add "2065552626", "<Recipient>"
'Choose to attach the fax to the fax receipt.
FaxDocumentObj.AttachFaxToReceipt = True
'Set the cover page type and the path of the cover page.
FaxDocumentObj.CoverPageType = fcptSERVER
FaxDocumentObj.CoverPage = "generic"
'Provide the cover page note.
FaxDocumentObj.Note = "This contains the information you requested."
'Provide the address for the fax receipt.
FaxDocumentObj.ReceiptAddress = "someone@example.com"
'Set the receipt type to e-mail.
FaxDocumentObj.ReceiptType = frtMAIL
'Specify that the fax is to be sent at a particular time
FaxDocumentObj.ScheduleType = fstSPECIFIC_TIME
'CDate converts the time to the Date data type
FaxDocumentObj.ScheduleTime = CDate("6:25:12 PM")
FaxDocumentObj.Subject = "Today's fax"
'Set the sender properties.
FaxDocumentObj.Sender.Title = "Mr."
FaxDocumentObj.Sender.Name = "Sender_Name"
FaxDocumentObj.Sender.City = "Sender_City"
FaxDocumentObj.Sender.State = "Sender_State"
FaxDocumentObj.Sender.Company = "Sender_Company"
FaxDocumentObj.Sender.Country = "Sender_Country"
FaxDocumentObj.Sender.Email = "someone@somewebsite.com"
FaxDocumentObj.Sender.FaxNumber = "4255550167"
FaxDocumentObj.Sender.HomePhone = "4255550987"
FaxDocumentObj.Sender.OfficeLocation = "My_Location"
FaxDocumentObj.Sender.OfficePhone = "4255550334"
FaxDocumentObj.Sender.StreetAddress = "123 Main Street"
FaxDocumentObj.Sender.TSID = "Office Fax"
FaxDocumentObj.Sender.ZipCode = "44118"
FaxDocumentObj.Sender.BillingCode = "23A54"
FaxDocumentObj.Sender.Department = "Accts Payable"
'Save sender information as default.
FaxDocumentObj.Sender.SaveDefaultSender
'Submit the document to the connected fax server, and retrieve the job ID.
JobIDObj = FaxDocumentObj.ConnectedSubmit(FaxServerObj)
MsgBox "The Job ID is :" & JobIDObj(0)
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
End Sub
- Install a fax printer to send a fax. If a fax printer is
not installed, you receive error number 800710D8. The following is the error
description:
- On the Run menu, click Start With
Full Compile to run the program.
The Print
dialog box that is mentioned in the "Symptoms" section appears.