Dim xlApp = GetObject(, "Excel.Application") MsgBox(xlApp.Workbooks.Count) For i1 As Integer = xlApp.Workbooks.Count To 1 Step -1 If xlApp.Visible.ToString = False Then xlApp.Workbooks.Item(i1).Close(SaveChanges:=False) Next
Dim process() As Process = System.Diagnostics.Process.GetProcessesByName("EXCEL") For Each p As Process In process If CDbl(p.MainWindowHandle) = 0 Then p.Kill() Next
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)