?
Solved

Send a HTML file to printer

Posted on 2004-10-25
2
Medium Priority
?
219 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
Comment
Question by:freg
2 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 500 total points
ID: 12403169
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
ID: 12403279
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

601 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