[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

I need help closing an Excel process from my ASP.Net application

I need help closing my Excel Process(es) in my ASP.Net application.
Even after I quit and close my Excel application programmatically, I still have an EXCEL.EXE process opened.  How can I close the Process?  I have included my code in this post and an image of the running Process.

Thanks in advance,
mrotor
Process
Dim objXL As Microsoft.Office.Interop.Excel.Application
Dim objWkB As Microsoft.Office.Interop.Excel.Workbook

objXL = New Microsoft.Office.Interop.Excel.Application
objWkB = objXL.Workbooks.Open(strLastQtrPSBD12)
objXL.Visible = False

‘SOME CODE…

objWkB.Close()
objXL.Quit()

objWkB = Nothing
objXL = Nothing

Open in new window

0
mainrotor
Asked:
mainrotor
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
you should stay away from Excel (specially on a server). check http://www.aspose.com/categories/.net-components/aspose.cells-for-.net/default.aspx
0
 
RickCommented:
Dim pr() As Process = Process.GetProcessesByName("excel")

For Each p As Process In pr
       p.CloseMainWindow()
Next
0
 
CodeCruiserCommented:
Try adding

System.Runtime.InteropServices.Marshal.ReleaseComObject(objWkB)
System.Runtime.InteropServices.Marshal.ReleaseComObject(objXL)


Do this before setting the objects to null.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now