+ Reply to Thread
Results 1 to 10 of 10

Out of Memory Error

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Out of Memory Error

    Hi,

    I am reading in a csv file using the following code:

    Please Login or Register  to view this content.

    The file i am reading in is rather large.....like 600,000 rows..........

    I dont know why i am getting an out of memory error........any ideas on why? And what to do about it?

    I have used this code in the past without any issues......but i guess there is always a first time.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Out of Memory Error

    If this is the first time it's happened, it could be because there are other programs that are running and using up the required memory. Try one or more of the following..
    To correct this error:
    •Close unnecessary applications, documents and source files.
    •Eliminate unnecessary controls and forms so fewer are loaded at one time
    •Reduce the number of Public variables.
    •Check available disk space.
    •Increase the available RAM by installing additional memory or reallocating memory.
    •Make sure that memory is freed when it is no longer needed.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Out of Memory Error

    i will review those things you mentioned. Really only the last two apply in my case.

    'How to reallocate memory
    'TO free memory is this just clearing arrays or is there more to it than that?


    Also, i have done some research and found that the method i am using might have a "string limit".......
    anyone have any thoughts on how i am reading in the file........perhaps there is a better method?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Out of Memory Error

    I can not explain in words. I know dates imported from text files some times give an error "out of memory". I am not sure the reason, but I suspect it might be excel treat these data as exceeding the text limits. I have my self come across this issue, but I do not understand the cause.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Out of Memory Error

    How have you declared entire_file_string?
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Out of Memory Error

    here is the declaration and code


    Please Login or Register  to view this content.

    so variable is defined as a string

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Out of Memory Error

    What do you do with the string? I'd suspect ADO, or just opening the file as a workbook, might be a better method of reading the data.

  8. #8
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Out of Memory Error

    well, i read in the entire file into a string variable. then i split off each "line" of the file into an array (see code below)

    Please Login or Register  to view this content.

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Out of Memory Error

    And what do you do with the data after that?

    If you use ADO you can extract a recordset from the CSV file, then either extract that into an array, or process it as needed. You can also do processing in the query you use to extract the data in the first place.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Out of Memory Error

    Do you need to open the entire file in one go?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Out of memory error
    By Karl Gustaf Karsten in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-23-2016, 02:00 PM
  2. [SOLVED] Out of Memory Error
    By chaddug in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-09-2015, 03:47 PM
  3. Replies: 1
    Last Post: 12-08-2011, 08:52 AM
  4. [SOLVED] Out of Memory Error
    By Gregory Kip in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2006, 06:35 PM
  5. Out of memory error
    By funkymonkUK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2005, 07:33 AM
  6. Error: Out of memory
    By Mangesh Yadav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-05-2005, 07:05 AM
  7. [SOLVED] How to handle error 8007000e Memory Error
    By L. A. M. in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-27-2005, 11:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1