PC Review


Reply
Thread Tools Rate Thread

Closing Excel

 
 
Charles A. Lackman
Guest
Posts: n/a
 
      25th Aug 2007
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)


 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      25th Aug 2007
Try Application.Quit

"Charles A. Lackman" wrote:

> 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)
>
>
>

 
Reply With Quote
 
Charles A. Lackman
Guest
Posts: n/a
 
      25th Aug 2007
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


"JLGWhiz" <(E-Mail Removed)> wrote in message
news:ED4B7415-0400-4CF4-983B-(E-Mail Removed)...
Try Application.Quit

"Charles A. Lackman" wrote:

> 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)
>
>
>



 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      25th Aug 2007
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" wrote:

> 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
>
>
> "JLGWhiz" <(E-Mail Removed)> wrote in message
> news:ED4B7415-0400-4CF4-983B-(E-Mail Removed)...
> Try Application.Quit
>
> "Charles A. Lackman" wrote:
>
> > 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)
> >
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing workbooks w/o closing Excel Barb in MD Microsoft Excel Misc 4 15th Feb 2010 06:44 PM
Excel 2003 when closing Excel after having opened a project locked for viewing.. password prompt??? braindead Microsoft Excel Misc 0 25th Mar 2005 01:58 PM
Closing excel application without closing all workbooks at the sa. =?Utf-8?B?S2l3aSBSb3hpZQ==?= Microsoft Excel Setup 2 30th Oct 2004 02:18 AM
Closing VB triggers closing Excel =?Utf-8?B?TWluaWxlaw==?= Microsoft Excel Programming 2 6th Aug 2004 05:17 PM
closing excel after closing a workbook CWalsh Microsoft Excel Programming 3 21st Jan 2004 03:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:43 AM.