From the course: Excel VBA: Process Modeling

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Delete objects to free up memory

Delete objects to free up memory

From the course: Excel VBA: Process Modeling

Start my 1-month free trial

Delete objects to free up memory

- When you use VBA to create instances of objects in Excel or other office programs, the program keeps those instances in memory until your code finishes running or you delete the objects deliberately. Excel handles object cleanup pretty well, but you can manage your computer's memory effectively by getting rid of objects you no longer need. In this movie, I will show you how to delete instances of objects in your collections. My sample file is Chapter01_05 and you can find it in the chapter one folder of the exercise files collection. We're working exclusively in VBA in this movie so there's nothing in the worksheet. I'll press Alt + F11 to move to the Visual Basic editor. And here I'm displaying the SimTest subroutine in the Module1 code module. The code in this module defines two object variables, objC as customer and Cusomters as a collection of the CCustomer that we had above and then it creates a new collection.…

Contents