Closing Excel

C

Charles A. Lackman

Hello I am having a problem closing excel (from the Process List) when I am
done using the Spreadsheet.

The code below works, however, when the application first starts, before I
create the Excel Object in code, the reference from the designer creates an
Excel.exe in the process list that never gets destroyed. I even tried
running the Garbage Collector, which still did not remove the process.

Any Suggestions are greatly appreciated,

Chuck

Code:
Excel = New Excel.Application
with Excel

..Application.DisplayAlerts = False
..ActiveWorkbook().SaveAs(TheSaveLocation,
..ActiveWorkbook.FileFormat.xlCSVWindows) ', TheFormat)
..ActiveWorkbook.Close()
..Quit()

End With

System.Runtime.InteropServices.Marshal.ReleaseComObject(Excel)
 
C

Charles A. Lackman

Hello,

I do not have an Application.Quit. However, in the code I showed below
"Excel" is the application and I am calling Quit.

Chuck


Try Application.Quit
 
G

Guest

I don't know what to tell you. Excel recognizes Application.Quit as the
command to shut down that instance of Excel. If you can't use that command
in your software, then you will probably have to close it manually.

Charles A. Lackman said:
Hello,

I do not have an Application.Quit. However, in the code I showed below
"Excel" is the application and I am calling Quit.

Chuck


Try Application.Quit

Charles A. Lackman said:
Hello I am having a problem closing excel (from the Process List) when I
am
done using the Spreadsheet.

The code below works, however, when the application first starts, before I
create the Excel Object in code, the reference from the designer creates
an
Excel.exe in the process list that never gets destroyed. I even tried
running the Garbage Collector, which still did not remove the process.

Any Suggestions are greatly appreciated,

Chuck

Code:
Excel = New Excel.Application
with Excel

..Application.DisplayAlerts = False
..ActiveWorkbook().SaveAs(TheSaveLocation,
..ActiveWorkbook.FileFormat.xlCSVWindows) ', TheFormat)
..ActiveWorkbook.Close()
..Quit()

End With

System.Runtime.InteropServices.Marshal.ReleaseComObject(Excel)
[/QUOTE]
[/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top