PC Review


Reply
Thread Tools Rate Thread

EXCEL keeps running in task manager

 
 
Sam
Guest
Posts: n/a
 
      21st Jan 2004
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 Before:=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
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      21st Jan 2004
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 "Before:=Sheets(1)" should read...
Before:=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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 Before:=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



 
Reply With Quote
 
 
 
 
Sam Gerene
Guest
Posts: n/a
 
      22nd Jan 2004
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!
 
Reply With Quote
 
Sandy V
Guest
Posts: n/a
 
      22nd Jan 2004
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

Before:=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
>.
>

 
Reply With Quote
 
Sam Gerene
Guest
Posts: n/a
 
      22nd Jan 2004
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 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
HELP: Desktop/Task Bar MISSING after Windows 2000 startup, but I can start desktop/task bar manually by issuing the 'CONTROL' command from TASK MANAGER/NEW TASK/RUN/CONTROL aniceguy45@hotmail.com Microsoft Windows 2000 Setup 0 4th Oct 2003 04:08 PM
HELP: Desktop/Task Bar MISSING after Windows 2000 startup, but I can start desktop/task bar manually by issuing the 'CONTROL' command from TASK MANAGER/NEW TASK/RUN/CONTROL aniceguy45@hotmail.com Microsoft Windows 2000 0 4th Oct 2003 03:52 PM
HELP: Desktop/Task Bar MISSING after Windows 2000 startup, but I can start desktop/task bar manually by issuing the 'CONTROL' command from TASK MANAGER/NEW TASK/RUN/CONTROL aniceguy45@hotmail.com Microsoft Windows 2000 Registry Archive 0 4th Oct 2003 03:01 AM
HELP: Desktop/Task Bar MISSING after Windows 2000 startup, but I can start desktop/task bar manually by issuing the 'CONTROL' command from TASK MANAGER/NEW TASK/RUN/CONTROL aniceguy45@hotmail.com Microsoft Windows 2000 Registry Archive 0 4th Oct 2003 03:01 AM
HELP: Desktop/Task Bar MISSING after Windows 2000 startup, but I can start desktop/task bar manually by issuing the 'CONTROL' command from TASK MANAGER/NEW TASK/RUN/CONTROL aniceguy45@hotmail.com Microsoft Windows 2000 Registry 0 4th Oct 2003 03:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:29 AM.