Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print a file without opening it?

Status
Not open for further replies.

19790203

Programmer
Oct 7, 2005
13
PL
is it possible to print a certain file without opening it?
 
In general you can use the ShellExecute API with the Print verb:
Code:
In Declarations section
Public 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

In Code
Public Sub PrintThisDoc(formname As Long, FileName As String)
    Dim x As Long
    x = ShellExecute(formname, "Print", FileName, 0&, 0&, 3)
End Sub

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
>>without opening it

It is not possible to print an excel file without opening the file. Excel needs to render the document to the printer. Using the ShellExecute method described above will still open the file.

If you want to get around the appearance of the file opening then you can use the excel object model to print it and just make it invisible to the user. If that is accepteble then just do a search or post back here for more info on that.
 
any file can't be printed w/out opening it...
simple reading of a file is actually opening it on a readonly mode

:)

Pls be specific with ur requirement/need and define also the purpose on why....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top