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