|
-
Dec 14th, 1999, 10:14 PM
#1
Thread Starter
Hyperactive Member
I got this code from the place you referenced. When it gets to "PID" it gives a run-time error 53 "File not found". I am using this in VBA - is there a reference I should be using?
'********************************************
Public Declare Function WaitForSingleObject _
Lib "kernel32" (ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Public Declare Function OpenProcess Lib _
"kernel32" (ByVal hHandle As Long, _
ByVal fInherit As Integer, _
ByVal hobject As Long) As Long
Sub PrintDoc
'myWd references a created instance of Word
myWd.activedocument.printout
WaitForProcessToEnd myWd
End Sub
Public Sub WaitForProcessToEnd(prog As String)
Dim retVal As Long, PID As Long, pHandle As Long
PID = Shell(prog) 'ERROR OCCURS HERE*****
pHandle = OpenProcess(&H100000, True, PID)
retVal = WaitForSingleObject(pHandle, 500) ' Infinite)
Screen.MousePointer = vbDefault
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|