Classes losing focus

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Classes losing focus

Post by agibsonsw »

Hello.
If I have a public Collection and run a procedure that adds an instance of my class to this collection, when will the collection 'vanish'?

Can I continue to use Excel and add further instances to the collection? Will it disappear if I save the workbook or edit some code?
Thanks, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
HansV
Administrator
Posts: 78826
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Classes losing focus

Post by HansV »

The collection will remain in memory until one of the following happens:

- The workbook containing the code is closed.
- You explicitly set the collection to Nothing.
- The code is reset; this happens when an unhandled error occurs, and usually also when you edit code.
Best wishes,
Hans

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Classes losing focus

Post by agibsonsw »

That's great, thanks.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.