+ Reply to Thread
Results 1 to 5 of 5

QueryTable Memory Leak

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco
    MS-Off Ver
    Excel 2007
    Posts
    11

    QueryTable Memory Leak

    Hi. I think the problem to this question involves my use of QueryTables but I may also suspect it has to do with me establishing connections with another computer. For a project at work, I have a set of files (1185 files to be exact) that exist on another computer called "projectpc3" under a directory

    "\\projectpc3\Data4_G_Share\X-DIR\FILE_15\DAT-X"

    I have an excel workbook that contains two sheets.
    The sheet called "FILES" contains the names of the 1185 files in Cells(7,2) through Cells(1191,2)
    My program creates a variable "k" that loops through each filename in "FILES", establishes a connection using a QueryTable taking the information from each file and pasting it into the sheet entitled "X".

    (1) I create two variables
    (2) I loop through all the files rerunning code snippets (3) (4) and (5)
    (3) establishes the connection to file "k" using a QueryTable and fills sheet("X") with the data from file "k"
    (4) deletes the QueryTable in step (3) (I think)
    (5) deletes the connection memory to file "k" on the other computer (I think)

    Obviously there is a lot more to it than this as I have additonal code to utilize the data in Sheet("X") for each iteration, but I have taken it out for simplicity.

    As it stands, despite steps (4) and (5), the program is leaking memory from my computer and will eventually
    give me an "OUT OF MEMORY" error. I can see the memory draining incrementally by viewing the Task Manager.

    Where is the memory leak coming from and how can I fix it? Any help would be greatly appreciated. Thank you.


    Please Login or Register  to view this content.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,416

    Re: QueryTable Memory Leak

    This is now the third thread you have started today, all on the same topic. Read the Forum Rules at the top of the screen and do not post the same question multiple times. Send a PM to a moderator and ask him/her to delete your duplicate threads.

    Pete

  3. #3
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: QueryTable Memory Leak

    Before you wrote this I already did. The first post violated the rules by not placing my code snippet with the code tag. The second post was an accidental duplicate click and is closed. I created this thread to fix the violation of the first and told the moderator in the first thread to close it. Although your post had good intentions, please let the moderators make those suggestions regarding forum rules and conduct.

    Thank you Pete.

  4. #4
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: QueryTable Memory Leak

    UPDATE:

    I investigated the matter further by determining if the memory leak is due to me accessing files from another computer. To test, I moved the "DAT-X" folder from the remote computer to my desktop and reran the code but instead accessed the copied folder on my computer. There was no memory leak this time. Therefore, when I access a file on another computer, it is storing that connection in memory somewhere. How do I get rid of it?

  5. #5
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: QueryTable Memory Leak

    Please Delete this Thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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