Hi' everyone,
I found out myself how to declare use "ShellExecute API" function in
Win Xp PRO to print a document. Here is the testet code - check out
the TstPrint rutine in the bottom:
'**************************************************************************************
Option Compare Database
'***************************START Declare
ShellExecute*************************
'''''
'************ Code Start **********
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
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
'***App Window Constants***
Public Const WIN_NORMAL = 1 'Open Normal
Public Const WIN_MAX = 3 'Open Maximized
Public Const WIN_MIN = 2 'Open Minimized
'***Error Codes***
Public Const ERROR_SUCCESS = 32&
Public Const ERROR_NO_ASSOC = 31&
Public Const ERROR_OUT_OF_MEM = 0&
Public Const ERROR_FILE_NOT_FOUND = 2&
Public Const ERROR_PATH_NOT_FOUND = 3&
Public Const ERROR_BAD_FORMAT = 11&
'''''
'***************************END Declare
ShellExecute*************************
'''''
Public Sub TstPrint()
Dim ret As Variant
ret = ShellExecute(0, "print", "d:\Test.doc", vbNullString, 0,
WIN_MIN)
End Sub