Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The Print dialog box appears when you fax an HTML document programmatically


View products that this article applies to.

Symptoms

When you try to fax an HTML document programmatically by using the fax APIs, a Print dialog box appears. The dialog box prompts you for user input.

↑ Back to the top


Cause

This problem occurs because Microsoft Internet Explorer is designed to prevent the Web pages and scripts from sending faxes programmatically without user input.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

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

  1. Start Microsoft Visual Basic 6.0. The New Project dialog box appears.
  2. On the New tab, click Standard EXE, and then click Open.
  3. On the Project menu, click References.
  4. 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.
  5. In the Project - Project1 window, right-click the Form1.frm form, and then click View Code.
  6. 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
    
  7. 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:
    Operation failed
  8. 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.

↑ Back to the top


References

For more information about using fax services, visit the following Microsoft Developer Network (MSDN) Web site:
Setting up the Development Environment
http://msdn2.microsoft.com/en-us/library/aa509148.aspx

↑ Back to the top


Keywords: KB841714, kbprb, kbcode, kbapi, kbfax

↑ Back to the top

Article Info
Article ID : 841714
Revision : 4
Created on : 1/18/2007
Published on : 1/18/2007
Exists online : False
Views : 271