title: VBA: Out of memory Error due to memory leak.... Can I manually call Garbage Collection?
body: <p>Novice programmer here. I have a code that copies 12 hours worth of data from a server and displays it in excel. My code takes the displayed code and exports it into a file, appending each 12 hours so that I can have a months worth of data.</p>
  
  <p>My problem is that after 20 days or so I run out of memory. Theoretically, it shouldn't take much more data than the original program and it running out of memory after 20 days says to me memory leak. In an old java program I had I just called the garbage collector with some frequency and the problem went away. Is there some way to do this in excel-vba? I've read about setting variables to nothing, but I have a lot of variables and I think the real issue has to do with it storing ALL of the read-in data as ram, and I don't know how to set that to zero.</p>
  
  <p>Other curious bit - after it crashed due to memory I cannot begin the program again without shutting down excel. So after crashing it doesn't delete things in memory?</p>
  
  <p>Thanks for any help</p>