Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Another Quit problem

Hi All,

I have read a lot about problems with getting Excel to quit from VBScript,
but none of the suggestions seem to work for me. I am using VBScript 5.6 and
Excel 2002 SP3.

It doesn't get much simpler than this:

Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")

Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing

oExcel.Quit
Set oExcel = Nothing
End Sub

Still, Excel is remaining active in the task-manager after running this
snippet. Leaving out the workbook-stuff (just starting and closing Excel)
works fine, but as soon as I start using an actual workbook, Excel won't
quit.

Does anybody have any ideas on how to solve this?

Thanks,

Paul


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Another Quit problem

Paul,

I do not use VB itself, but using VBA within the workbook, I use
Application.Quit. Then in the Workbook_Close(), I use
Application.DisplayAlerts = False. Maybe you might need to place some VBA in
your workbook that you are opening in the VB script to totally close Excel.
However, to make it open/close without any prompting I use a digital
signature in the VBA so that when the workbook opens, it does not prompt
regarding macro security.

Just a thought.

Dean.

"Paul van Kan" wrote:

Hi All,

I have read a lot about problems with getting Excel to quit from VBScript,
but none of the suggestions seem to work for me. I am using VBScript 5.6 and
Excel 2002 SP3.

It doesn't get much simpler than this:

Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")

Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing

oExcel.Quit
Set oExcel = Nothing
End Sub

Still, Excel is remaining active in the task-manager after running this
snippet. Leaving out the workbook-stuff (just starting and closing Excel)
works fine, but as soon as I start using an actual workbook, Excel won't
quit.

Does anybody have any ideas on how to solve this?

Thanks,

Paul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Another Quit problem

Thanks Dean,

At the moment, I don't even care about the prompt. All I am looking to do is
open a workbook and close it again, without leaving an Excel footprint in
the task-manager.

Again, all help is appreciated.

Paul

"Dean Hinson" schreef in bericht
...
Paul,

I do not use VB itself, but using VBA within the workbook, I use
Application.Quit. Then in the Workbook_Close(), I use
Application.DisplayAlerts = False. Maybe you might need to place some VBA
in
your workbook that you are opening in the VB script to totally close
Excel.
However, to make it open/close without any prompting I use a digital
signature in the VBA so that when the workbook opens, it does not prompt
regarding macro security.

Just a thought.

Dean.

"Paul van Kan" wrote:

Hi All,

I have read a lot about problems with getting Excel to quit from
VBScript,
but none of the suggestions seem to work for me. I am using VBScript 5.6
and
Excel 2002 SP3.

It doesn't get much simpler than this:

Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")

Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing

oExcel.Quit
Set oExcel = Nothing
End Sub

Still, Excel is remaining active in the task-manager after running this
snippet. Leaving out the workbook-stuff (just starting and closing Excel)
works fine, but as soon as I start using an actual workbook, Excel won't
quit.

Does anybody have any ideas on how to solve this?

Thanks,

Paul





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Another Quit problem

Any chance excel is sitting there waiting for a response from the user?

maybe adding a line to make excel visible will lead you to an answer.

Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True

Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing

oExcel.Quit
Set oExcel = Nothing
End Sub


Paul van Kan wrote:

Hi All,

I have read a lot about problems with getting Excel to quit from VBScript,
but none of the suggestions seem to work for me. I am using VBScript 5.6 and
Excel 2002 SP3.

It doesn't get much simpler than this:

Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")

Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing

oExcel.Quit
Set oExcel = Nothing
End Sub

Still, Excel is remaining active in the task-manager after running this
snippet. Leaving out the workbook-stuff (just starting and closing Excel)
works fine, but as soon as I start using an actual workbook, Excel won't
quit.

Does anybody have any ideas on how to solve this?

Thanks,

Paul


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Another Quit problem

I'm having the same problem, although I'm using Excel through .Net Interop.
My code is:

Dim app As New Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet

wb = app.Workbooks.Open(PathAndFilename)
ws = wb.Worksheets(1)

app.DisplayAlerts = False
ws.SaveAs(PathAndFilename)
app.Workbooks(1).Close()
app.Quit()

ws = Nothing
wb = Nothing
app = Nothing


I even tried adding GC.Collect, but that didn't do it either. I still see a
copy of EXCEL.EXE in Task Manager. I'm starting to think I need to do
Thread.Kill or something drastic like that.



"Dave Peterson" wrote:

Any chance excel is sitting there waiting for a response from the user?

maybe adding a line to make excel visible will lead you to an answer.

Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True

Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing

oExcel.Quit
Set oExcel = Nothing
End Sub


Paul van Kan wrote:

Hi All,

I have read a lot about problems with getting Excel to quit from VBScript,
but none of the suggestions seem to work for me. I am using VBScript 5.6 and
Excel 2002 SP3.

It doesn't get much simpler than this:

Sub Main()
Dim oExcel
Dim oWorkBook
Set oExcel = CreateObject("Excel.Application")

Set oWorkBook = oExcel.WorkBooks.Open("C:\TEST.XLS")
oWorkBook.Close False
Set oWorkBook = Nothing

oExcel.Quit
Set oExcel = Nothing
End Sub

Still, Excel is remaining active in the task-manager after running this
snippet. Leaving out the workbook-stuff (just starting and closing Excel)
works fine, but as soon as I start using an actual workbook, Excel won't
quit.

Does anybody have any ideas on how to solve this?

Thanks,

Paul


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel application.quit in macro problem TimkenSteve New Users to Excel 3 August 17th 06 06:36 PM
The old application.quit problem Hafeez Excel Programming 1 June 21st 04 10:53 AM
The old application.quit problem Don Guillett[_4_] Excel Programming 1 June 20th 04 03:08 PM
The old application.quit problem Tom Ogilvy Excel Programming 0 June 20th 04 02:56 PM
Application.quit yuiriy Excel Programming 4 June 10th 04 08:36 AM


All times are GMT +1. The time now is 05:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"