Ciao
Ti passo la mia soluzione
Me.btnPREVIEW.Enabled = False
Dim myOLDProcess As Process
Dim allOLDProcess As Process() = Process.GetProcessesByName("EXCEL")
'ESEGUO EXCEL ---------------------
.....
xlSheet = Nothing
xlBook = Nothing
xlApp = Nothing
'FINE EXCEL ---------------------
System.Threading.Thread.Sleep(3000)
Dim value As Boolean = False
Dim killProcess As Integer
Dim myNEWProcess As Process
Dim allNEWProcess() As Process = Process.GetProcessesByName("EXCEL")
If allOLDProcess.Length = 0 Then
For Each myNEWProcess In allNEWProcess
killProcess = myNEWProcess.Id
Next
Else
For Each myNEWProcess In allNEWProcess
Dim idProcess As Integer = myNEWProcess.Id
For Each myOLDProcess In allOLDProcess
If idProcess = myOLDProcess.Id Then
value = False
Else
value = True
End If
Next
If value = True Then
killProcess = (myNEWProcess.Id)
End If
Next
End If
Dim exlProcess As Process = Process.GetProcessById(killProcess)
exlProcess.Kill()
Me.btnPREVIEW.Enabled = True
Ciao
alexmed