Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 6
Default EXCEL keeps running in task manager

I've got the following problem:

When I open an excel file from VB6, save it and close it again EXCEL
does not remain in the taskbar, but when I make a copy of a sheet and
save and close the file excel does remain?

Anybody has an idea?

This doesn't work:

Dim XLObj as Public XLObj As Excel.Application
Set XLObj = CreateObject("Excel.Application") XLObj.Workbooks.Open
"c:\test_file.xls"
XLObj.DisplayAlerts = False
XLObj.ActiveWorkbook.Sheets("testsheet").Copy Befo=Sheets(1)
XLObj.ActiveWorkbook.Save
XLObj.ActiveWorkbook.Close
XLObj.UserControl = False
XLObj.DisplayAlerts = True
XLObj.Quit
Set XLObj = Nothing

This works:
Dim XLObj as Public XLObj As Excel.Application
Set XLObj = CreateObject("Excel.Application") XLObj.Workbooks.Open
"c:\test_file.xls"
XLObj.DisplayAlerts = False
XLObj.ActiveWorkbook.Save
XLObj.ActiveWorkbook.Close
XLObj.UserControl = False
XLObj.DisplayAlerts = True
XLObj.Quit
Set XLObj = Nothing
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default EXCEL keeps running in task manager

Sam,

The first thing I spotted is an unqualified reference to the new sheet.
All references to anything in Excel using automation should be qualified with
the proper parent reference.
Therefore "Befo=Sheets(1)" should read...
Befo=XLObj.ActiveWorkbook.Sheets(1)
Unless this is done, an "orphan" is created and Excel will refuse to quit.

Also, I am curious, are the Set statement and Workbooks.Open statement really on
the same line?

Regards,
Jim Cone
San Francisco, CA

"Sam" wrote in message
m...
I've got the following problem:

When I open an excel file from VB6, save it and close it again EXCEL
does not remain in the taskbar, but when I make a copy of a sheet and
save and close the file excel does remain?
Anybody has an idea?
This doesn't work:


Dim XLObj as Public XLObj As Excel.Application
Set XLObj = CreateObject("Excel.Application") XLObj.Workbooks.Open
"c:\test_file.xls"
XLObj.DisplayAlerts = False
XLObj.ActiveWorkbook.Sheets("testsheet").Copy Befo=Sheets(1)
XLObj.ActiveWorkbook.Save
XLObj.ActiveWorkbook.Close
XLObj.UserControl = False
XLObj.DisplayAlerts = True
XLObj.Quit
Set XLObj = Nothing


This works:
Dim XLObj as Public XLObj As Excel.Application
Set XLObj = CreateObject("Excel.Application") XLObj.Workbooks.Open
"c:\test_file.xls"
XLObj.DisplayAlerts = False
XLObj.ActiveWorkbook.Save
XLObj.ActiveWorkbook.Close
XLObj.UserControl = False
XLObj.DisplayAlerts = True
XLObj.Quit
Set XLObj = Nothing



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default EXCEL keeps running in task manager

I'll try it tomorrow... I had read about the orphan "problem" but I
missed the "before" line.

Thanks for the help :-) Hope it works

ps: Set XLObj = CreateObject("Excel.Application")
XLObj.Workbooks.Open are indeed on 2 seperate lines!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default EXCEL keeps running in task manager

If I understand, you are left with an invisible instance
of Excel. Not an answer to your question, but to get out
of trouble Robert Bruce has a vbs script he has titled:

"Activate A Lost, Hidden Excel Instance"

http://myweb.tiscali.co.uk/xlvba/exc...elop/index.htm

Regards,
Sandy
savituk yahoo co uk

-----Original Message-----
I've got the following problem:

When I open an excel file from VB6, save it and close it

again EXCEL
does not remain in the taskbar, but when I make a copy of

a sheet and
save and close the file excel does remain?

Anybody has an idea?

This doesn't work:

Dim XLObj as Public XLObj As Excel.Application
Set XLObj = CreateObject("Excel.Application")

XLObj.Workbooks.Open
"c:\test_file.xls"
XLObj.DisplayAlerts = False
XLObj.ActiveWorkbook.Sheets("testsheet").Copy

Befo=Sheets(1)
XLObj.ActiveWorkbook.Save
XLObj.ActiveWorkbook.Close
XLObj.UserControl = False
XLObj.DisplayAlerts = True
XLObj.Quit
Set XLObj = Nothing

This works:
Dim XLObj as Public XLObj As Excel.Application
Set XLObj = CreateObject("Excel.Application")

XLObj.Workbooks.Open
"c:\test_file.xls"
XLObj.DisplayAlerts = False
XLObj.ActiveWorkbook.Save
XLObj.ActiveWorkbook.Close
XLObj.UserControl = False
XLObj.DisplayAlerts = True
XLObj.Quit
Set XLObj = Nothing
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default EXCEL keeps running in task manager

Thanks Jim,

It did the trick! One problem less to wory about :-)



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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 close on startup, but stay in task manager Thomas Excel Discussion (Misc queries) 3 May 20th 10 06:58 AM
Excel still running in task manager after closing the application Willem Excel Discussion (Misc queries) 0 December 5th 06 01:56 PM
Task Manager and Excel 2003 Mike Excel Discussion (Misc queries) 1 April 20th 05 10:40 PM
get the program id of an excel application from the task manager nikolaosk[_5_] Excel Programming 2 October 14th 03 03:06 PM
Excel Remains Active in Windows Task Manager Philip Wybo Excel Programming 2 August 27th 03 09:30 AM


All times are GMT +1. The time now is 03:11 PM.

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"