Solved

Send a HTML file to printer

Posted on 2004-10-25
204 Views
Last Modified: 2008-03-10
Hi !

I want to know what is the simplest and faster way to print a HTML file in VB, without opening it in the default web browser.

Thanks,

Freg.

0
Question by:freg
    2 Comments
     
    LVL 28

    Accepted Solution

    by:
    Have you tried shellexecute API:

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    Private Sub Command1_Click()
    Call ShellExecute(hwnd, "Print", ("C:\Somefile.html"), "", "",0)
    End Sub
    0
     
    LVL 1

    Author Comment

    by:freg
    Ok it works.  You answered the question literally, but in fact i need a bit more control, like choosing orientation or paper size, and send it directly to the printer, without dialog window (printer dialog)... is it possible ?
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now