Results 1 to 3 of 3

Thread: Does anyone know how to print a HTML document from the WebBrowser control?

  1. #1
    Guest

    Red face

    I have tried:
    Code:
    Printer.print WebBrowser1.Document
    but this simply printed the word "[object]" on the page.

    I cant seem to find any reference to printing in the webbrowser section of the MSDN library CD.

    $1,000,000 to the person* that solves this!















    * Martian Dollars, MD$1 = $0.00000001

    Hehehe thanks!

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use the SendKeys statement:
    Code:
    WebBrowser1.SetFocus
    SendKeys "^p", True
    Good luck!

    PS. You can keep your money!

  3. #3
    Guest
    This is the code i use.

    Code:
    Private Sub cmdPrint_Click()
        Dim eQuery      As OLECMDF
    
        On Error Resume Next
        eQuery = WebBrowser1.QueryStatusWB(OLECMDID_PRINT)
        If Err.Number = 0 Then
            If eQuery And OLECMDF_ENABLED Then
                WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER, "", ""
            Else
                MsgBox "The Print command is currently disabled."
            End If
        End If
        If Err.Number <> 0 Then MsgBox "Print command Error: " & Err.Description
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width