Click to See Complete Forum and Search --> : Out Of Memory Vba problem
asihuay
Feb 22nd, 2004, 01:59 PM
Hi.
My Pc is PIII 866Mhz 256Mb ram 40Gb HD
under windows ME and office 2000
I have excel file with big Vba macro this run fine, now I create another option to my macro , when run this option open another excel file with auto_open macros at this time I obtain "Out of Memory" windows message, how can I solve this problem?
Thanks in advance.
asihuay
BrianB
Feb 23rd, 2004, 09:12 AM
You do not say how big both files are.
256 mb. RAM may not be enough to hold them both in memory.
asihuay
Feb 23rd, 2004, 08:28 PM
Hi. BrianB
The files are about 1.4 mb , I do not thing the problem is in the sistem ram ,I think is the excel way to manage memory, anything occur when run code to open workbook with workbook_open event I want know how solve this.
Thanks in advance.
alex_read
Feb 25th, 2004, 03:17 AM
Are you properly closing and setting your object variables to nothing throughout your code at the earliest opportunity
biswajitdas
Feb 25th, 2004, 06:01 AM
Please destroy the object after using
set excel.sheet = nothing
it relase the space
if not then incrses you virtual memory
and clean the even viewwer
asihuay
Feb 25th, 2004, 07:08 AM
HI. biswajitdas and alex_read
Can you guive me code in order to determine how object are in memory ?
Thanks.
alex_read
Feb 25th, 2004, 07:13 AM
Try this sort of thing all throughout your project:
Dim objXLApp as Excel.Application
Set objXLApp = new Excel.Application
If not (objXLApp is nothing) then
' Object's created fine - run code against it here
objXLApp.workbooks(1).close
objXLApp.Quit
Set objXLApp = nothing
End If
By doing this, you avoid errors when you check the objects are open/created before you use them, and you release them from memory shen they are no longer needed (most objects will have some kind of close() or exit() etc. method you can call & you should always use the "Set xyz = nothing" call when you're finished with an object)...
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.