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.
Bookmarks