MrExcel Publishing
Your One Stop for Excel Tips & Solutions

out of memory running a macro...

Posted by rm on January 30, 2002 10:35 AM


I have a macro that works okay, but when I ran it on one occassion (yesterday), there was an "out of memory" error, and the sub there a way in vba code to clear and reclaim memory so that this will not happen again in the future? I would like to place this command, if it exists, in a loop so that it will clean up memory before going to the next loop.

(Because this macro loops over several documents and takes a couple of hours to complete, I run it unattended, usually before leaving work for the day.)

Thanks for any advice!

Posted by JACK in the UK on January 30, 2002 3:59 PM

Hi rm -- good to see you post

Set the memory held items to nothing at the end of their run, or end scipt this will help fee resources.

Are you running win95 or 8 if so its worse, NT would help just a point,

Without seeing all the code its hard to say much more.


Posted by rm on January 30, 2002 4:54 PM

Hi Jack,

thanks for the response...I'll try this method and post again if doesn't work (will try running again when I go home!)

...sorry bout the missing info...I'm using excel2000 on nt4 at work.