Method: WinExcel::ExcelFile.killExcelAutomationProcesses

Defined in:
lib/winexcel/excel_file.rb

.killExcelAutomationProcessesObject



208
209
210
211
212
213
214
215
216
217
# File 'lib/winexcel/excel_file.rb', line 208

def self.killExcelAutomationProcesses
  begin
    wmi = WIN32OLE.connect("winmgmts://")
    processes = wmi.ExecQuery("select * from win32_process where commandline like '%excel.exe\"% /automation %'")
    processes.each do |process|
      Process.kill('KILL', process.ProcessID)
    end
  rescue
  end
end