Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel hanging... | Excel Discussion (Misc queries) | |||
Hanging Instance of Excel | Excel Programming | |||
How do I get one instance of Excel to communicate with another instance? | Excel Programming | |||
Excel-created Word instance hanging on thru Outlook? | Excel Programming | |||
Excel hanging up | Excel Programming |