Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Excel Instance Hanging Around

Why does this code keep an Excel instance hanging around? I free all
the COM objects:


Sub Test()
Set oXL = CreateObject("Excel.Application")
Set WBs = oXL.Workbooks
Set Wkbk = WBs.Add
Set Wkbk = Nothing
Set WBs = Nothing
oXL.Quit
Set oXL = Nothing
End Sub

If I remove the WBs.Add line then the instance disappears as it
should; what hidden object is created there and how do I free it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Excel Instance Hanging Around

When I run that exact code in VBA it creates and ends the new instance of
XL... I assume that is not your experience. To that end this is just a shot
in the dark. You create a workbook but you don't close the book prior to
deleting your object reference to the book. Perhaps add a close somehitn like
this...

Sub Test()
Set oXL = CreateObject("Excel.Application")
Set WBs = oXL.Workbooks
Set Wkbk = WBs.Add
Wkbk.Close Save:=False 'or something like this
Set Wkbk = Nothing
Set WBs = Nothing
oXL.Quit
Set oXL = Nothing
End Sub

--
HTH...

Jim Thomlinson


" wrote:

Why does this code keep an Excel instance hanging around? I free all
the COM objects:


Sub Test()
Set oXL = CreateObject("Excel.Application")
Set WBs = oXL.Workbooks
Set Wkbk = WBs.Add
Set Wkbk = Nothing
Set WBs = Nothing
oXL.Quit
Set oXL = Nothing
End Sub

If I remove the WBs.Add line then the instance disappears as it
should; what hidden object is created there and how do I free it?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Excel Instance Hanging Around

Sorry,,, Change
Save:=False
to
SaveChanges:=false
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

When I run that exact code in VBA it creates and ends the new instance of
XL... I assume that is not your experience. To that end this is just a shot
in the dark. You create a workbook but you don't close the book prior to
deleting your object reference to the book. Perhaps add a close somehitn like
this...

Sub Test()
Set oXL = CreateObject("Excel.Application")
Set WBs = oXL.Workbooks
Set Wkbk = WBs.Add
Wkbk.Close Save:=False 'or something like this
Set Wkbk = Nothing
Set WBs = Nothing
oXL.Quit
Set oXL = Nothing
End Sub

--
HTH...

Jim Thomlinson


" wrote:

Why does this code keep an Excel instance hanging around? I free all
the COM objects:


Sub Test()
Set oXL = CreateObject("Excel.Application")
Set WBs = oXL.Workbooks
Set Wkbk = WBs.Add
Set Wkbk = Nothing
Set WBs = Nothing
oXL.Quit
Set oXL = Nothing
End Sub

If I remove the WBs.Add line then the instance disappears as it
should; what hidden object is created there and how do I free 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 hanging... Jambo Excel Discussion (Misc queries) 1 May 30th 08 03:13 PM
Hanging Instance of Excel Terry Excel Programming 6 June 30th 07 08:42 PM
How do I get one instance of Excel to communicate with another instance? [email protected] Excel Programming 3 November 21st 06 10:31 PM
Excel-created Word instance hanging on thru Outlook? Ed Excel Programming 0 November 3rd 05 03:31 PM
Excel hanging up Dave Peterson[_3_] Excel Programming 0 September 9th 04 07:10 PM


All times are GMT +1. The time now is 12:26 PM.

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

About Us

"It's about Microsoft Excel"