Results 1 to 7 of 7

Thread: Out Of Memory Vba problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Guayaquil
    Posts
    3

    Question Out Of Memory Vba problem

    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

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    You do not say how big both files are.
    256 mb. RAM may not be enough to hold them both in memory.
    Regards
    BrianB
    -------------------------------

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Guayaquil
    Posts
    3

    Question

    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.

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Are you properly closing and setting your object variables to nothing throughout your code at the earliest opportunity

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5
    Banned
    Join Date
    Jul 2003
    Location
    New delhi
    Posts
    143
    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

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Location
    Guayaquil
    Posts
    3

    Question

    HI. biswajitdas and alex_read
    Can you guive me code in order to determine how object are in memory ?
    Thanks.

  7. #7
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Try this sort of thing all throughout your project:
    VB Code:
    1. Dim objXLApp as Excel.Application
    2. Set objXLApp = new Excel.Application
    3.  
    4. If not (objXLApp is nothing) then
    5.     ' Object's created fine - run code against it here
    6.  
    7.     objXLApp.workbooks(1).close
    8.     objXLApp.Quit
    9.     Set objXLApp = nothing
    10. 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)...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width