I am using vb.NET 2003 and I have to be able to close an Excel Window that I have to handle to because I didn't create it. Is this possible?
Printable View
I am using vb.NET 2003 and I have to be able to close an Excel Window that I have to handle to because I didn't create it. Is this possible?
well in vb6 its like this.. should be somewhat similar in 2003
VB Code:
Private Sub CloseAllExcel() On Error GoTo AllClosed Dim XLS As Object Do Set XLS = GetObject(, "Excel.Application") XLS.quit Loop AllClosed: End Sub
Actually its very different Static. You would want to get an array of all the Excel running processses and then kill each one. This would be th .NET way but for the VB 6 GetObject way it is still very similar. ;)
VB Code:
Dim oProcess As Process For Each oProcess In System.Diagnostics.Process.GetProcessesByName("EXCEL") 'MessageBox.Show(oProcess.ProcessName.ToString) oProcess.Kill() Next
WOW.. I guess its about time I start learning .Net...
just wish I actually HAD .net :(
You can DL the Express (hobbiest) version for free.
.NET is cool! :D
Thanks, I'll give it a shot.