hbanthai
Had this question 5
Question
hbanthai asked on
| 9182 views

Why My VBA program always show "Out of memory" ?

How many memory the VBA program needs ? When I start the excel worksheet, It don't have that problem. After Pass through 2-3 minute I run the program. The alarm will appear it. sometimes it's don't work & Hang it. I need to close all excel file, Then restart it again. Pls. to provide some idea for me. Thanks,

Bannette.chen

 

Rick Rothstein, MVP - Excel
Found this helpful 0
Rick Rothstein, MVP - Excel replied on
MVP
The "Out of Memory" is not based on a limitation in the size a program can be; rather, it indicates your program is attempting to use all the memory in the system. This usually occurs in an out-of-control loop of some kind. There is no way we can give you more information than that without seeing the actual code you are attempting to run. Can you post your code for us to see?
NOTE: Please mark the message or messages (yes, you can mark more than one) that answer your question as the "Answer" so that others will know your question has been resolved.
*** PLEASE READ ***

If this response answers your question, please mark it as the "Answer".
hbanthai
Found this helpful 0
hbanthai replied on

Reply

I think the Code is out of memory (Error 7). I don't know how to paste the attach file for you. the below is from excel help :

There are 7 solution, I don't know which one I will improve & solve it. Pls. to offer your suggestion or advise. Thanks.

  • You have too many applications, documents, or source files open.

    Close any unnecessary applications, documents, or source files that are open.

  • You have a module or procedure that's too large.

    Break large modules or procedures into smaller ones. This doesn't save memory, but it can prevent hitting 64K segment boundaries.

  • You are running Microsoft Windows in standard mode.

    Restart Microsoft Windows in enhanced mode.

  • You are running Microsoft Windows in enhanced mode, but have run out of virtual memory.

    Increase virtual memory by freeing some disk space, or at least ensure that some space is available.

  • You have terminate-and-stay-resident programs running.

    Eliminate terminate-and-stay-resident programs.

  • You have many device drivers loaded.

    Eliminate unnecessary device drivers.

  • You have run out of space for Public variables.

    Reduce the number of Public variables

    bannette.chen

    hbanthai
    Found this helpful 0
    hbanthai replied on

    Reply

    The "Out of Memory" is not based on a limitation in the size a program can be; rather, it indicates your program is attempting to use all the memory in the system. This usually occurs in an out-of-control loop of some kind. There is no way we can give you more information than that without seeing the actual code you are attempting to run. Can you post your code for us to see?
    NOTE: Please mark the message or messages (yes, you can mark more than one) that answer your question as the "Answer" so that others will know your question has been resolved.

    I think the Code is out of memory (Error 7). I don't know how to paste the attach file for you. the below is from excel help :

    There are 7 solution, I don't know which one I will improve & solve it. Pls. to offer your suggestion or advise. Thanks.

  • You have too many applications, documents, or source files open.

    Close any unnecessary applications, documents, or source files that are open.

  • You have a module or procedure that's too large.

    Break large modules or procedures into smaller ones. This doesn't save memory, but it can prevent hitting 64K segment boundaries.

  • You are running Microsoft Windows in standard mode.

    Restart Microsoft Windows in enhanced mode.

  • You are running Microsoft Windows in enhanced mode, but have run out of virtual memory.

    Increase virtual memory by freeing some disk space, or at least ensure that some space is available.

  • You have terminate-and-stay-resident programs running.

    Eliminate terminate-and-stay-resident programs.

  • You have many device drivers loaded.

    Eliminate unnecessary device drivers.

  • You have run out of space for Public variables.

    Reduce the number of Public variables

    bannette.chen

    Rick Rothstein, MVP - Excel
    Found this helpful 0
    Rick Rothstein, MVP - Excel replied on
    MVP

    Reply

    We don't need your file (at least not right now), rather, we just need to see your VB code that is causing the error. You should be able to select the code in your project, copy it to the Clipboard and then Paste it into a response to this message.
    NOTE: Please mark the message or messages (yes, you can mark more than one) that answer your question as the "Answer" so that others will know your question has been resolved.
    *** PLEASE READ ***

    If this response answers your question, please mark it as the "Answer".
    Bob Flanagan
    Found this helpful 0
    Bob Flanagan replied on
    IdaNivelli
    Found this helpful 0
    IdaNivelli replied on

    Reply

    use this istruction before use and save istrucion--
      
    Set cbrReset = Application.VBE.CommandBars(1).Controls("&Run").Controls("&Reset")
      cbrReset.Execute
    HaroldSimons
    Found this helpful 0
    HaroldSimons replied on

    Reply

    One of the Error 7 solutions is to "Restart Microsoft Windows in enhanced mode". I want to try this but I don't know how to accomplish such a restart. I received this error on a computer running Windows 98SE. Thank you for your assistance.

    Harold Simons