Hi all,
I am trying to automate excel. And creating excel object as
Code:
oExcel = CreateObject("Excel.Application")
And trying to close/kill(Kill ) the Excel in Process window using

Code:
 For Each P as Process In Process.GetProcessByName("Excel") 
    if p.MainWindowHandle.ToInt32 == oExcel )
     p.kill
   end if
 Next
But the P.MainWindowHandle.ToInt32 is always 0

I have tried this one , Which works for simple methods and not for complex methods