Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MS Excel staying resident in task manager

Posted on 2013-01-17
4
368 Views
Last Modified: 2013-01-17
Included below is some simple VB code from a spreadsheet that is called via a batch
file every hour by the Windows Task Scheduler. It basically opens various Excel
workbooks and saves a certain portion of each one as .htm output in a common directory.
It takes about 20 minutes to run and generates about 650 individual files each time.
The code ran fine for many years, but recently we began having an issue where all of
the code executes OK, but Excel stays resident in the Windows Task Manager, which
causes a problem the next time the file tries to run because Excel thinks that the
file is still open. We have upgraded the server from Windows 2003 32bit to Windows 2008 64bit. We are running MS Excel 2007. While doing some searches on the internet we discovered this brief
article (http://www.tushar-mehta.com/excel/vba/xl_doesnt_quit/) which describes exactly
what we are seeing.  Having somewhat limited knowledge of VB, we are wondering if the
solution described in that article would be of use to us, and if so, we need a little
guidance as to how and where to implement it in our code. If perhaps there is something
else we could try to resolve the problem, that would be great too. Thanks for any input.
Code.txt
0
Comment
Question by:clynch302
  • 2
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 38788234
yes remove the instruction
Application.Quit
from the Workbook_Open and put it in

Workbook_BeforeClose

so that the code in workbook become like the attached following:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    
    Application.Quit
    
End Sub

Private Sub Workbook_Open()

    Call generate_htm_files
    ActiveWorkbook.Saved = True
    ActiveWorkbook.Close
    
End Sub

Open in new window


gowflow
0
 

Author Comment

by:clynch302
ID: 38788373
Thanks for the quick response. I will update the code and test. I will let you know...Thanks
0
 

Author Closing Comment

by:clynch302
ID: 38788926
Looked like it worked. Thanks for your time.
0
 
LVL 29

Expert Comment

by:gowflow
ID: 38789075
your welcome.
gowflow
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question