I am trying out the "shellexecuteex" but can't get past step 1. My goal is to read a file and print documents without any user intervention. I've been studying some examples on this forum but I must be missing pieces. When trying to run this program, it errors out at the stament "me.hwnd" - according to the error, I need a class module(??) -- I have this code in a standard module. Doing API's is a deeper than I've gone before with VB, but willing to figure this out.
STANDARD MODULE
***
Private Sub Main()
Dim strdocname As String
strdocname = "c:\data\bs-original\bksv1"
Call OpenThisDoc(Me.hwnd, strdocname)
End Sub
****************************************
GLOBAL MODULE
***
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
Public Sub OpenThisDoc(formname As Long, filename As String)
On Error Resume Next
Dim x As Long
x = shellexecute(formname, "Print", filename, 0&, 0&, 3)
End Sub
*****************
Thoughts would be appreciated!
cramd
STANDARD MODULE
***
Private Sub Main()
Dim strdocname As String
strdocname = "c:\data\bs-original\bksv1"
Call OpenThisDoc(Me.hwnd, strdocname)
End Sub
****************************************
GLOBAL MODULE
***
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
Public Sub OpenThisDoc(formname As Long, filename As String)
On Error Resume Next
Dim x As Long
x = shellexecute(formname, "Print", filename, 0&, 0&, 3)
End Sub
*****************
Thoughts would be appreciated!
cramd