Discussion Locked

Printing in VB6 Without Print dialog box

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Im using the following command to print a webpage which is working Quite fine

ShellExecute 0&, "Print", "C:\Innovation\Temp\statement.html", "", "", vbNormalFocus

I used the following command as well which i found from a website

Call ShellExecute(Me.hwnd, "print", "TheScarms.xls", "", 0, SW_SHOWNORMAL)

The above command prints a file as well and does exactly the same

There is one problem im having

I dont want the Printer Dialog to appear

I would like my program to use the default printer or i would like it to Select a printer via my code

if i can have both it would be great

I hope someone can help me with this

Thanks

Mr R Hoosain

1 reply

by kalle006

I tried this that i found on the web, and it works for me,

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

lblbezig_met.Caption = "ShellExecute Me.hwnd printen: " & Bestemming
ShellExecute Me.hwnd, "print", Bestemming, 0, "C:\", 12
lblbezig_met.Caption = "Klaar met printen: " & Bestemming

Greetings
Leo

This discussion is closed to new replies.