Ancora un pò di pazienza.



ho inserito il codice:Private Declare Function WaitForSingleObject

Lib "KERNEL32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function OpenProcess Lib "KERNEL32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "KERNEL32" (ByVal hObject As Long) As Long

Const INFINITE = -1

Public Sub ShellWait(ByVal FileName As String, Optional WindowStyle As Variant)
Dim idProc As Long
Dim hProc As Long

idProc = VBA.Shell(FileName, WindowStyle)

hProc = OpenProcess(&H1F0FFF, False, idProc)

If hProc <> 0 Then
Call WaitForSingleObject(hProc, INFINITE)
Call CloseHandle(hProc)
End If
End Sub



ma quando avvio

ShellWait "c:\Mario.exe" mi segnala

error Run-Time 13 - Tipo non corrispondente sulla riga


[B]idProc = VBA.Shell(FileName, WindowStyle)

la stessa cosa se indico


ShellWait ("c:\Mario.exe")


Cosa devo modificare.??


Ancora mille grazie.