PDA

View Full Version : Solved: Workbook Slowdown



IRish3538
10-17-2012, 01:59 PM
This is a pretty general question so bear with me. I have a workbook with an obscene amount of code in it. The file size is about 1.5MB. One sub that I have opens up all workbooks within a folder, then transfers some of the inputs into the master workbook.. The code itself runs fine but for some reason once it's completed, excel (as an application) hiccups. every 5 seconds or so it freezes up for half a second. I have no clue why this would happen. I'm trying to get some general ideas as to how this could happen without actually pasting all the code

Things that (I think) I know:
- It's not a computer resource issue (and it's not because of any public variables. The very end of my code i release everyting with the "End" command..
- it's affecting excel as a whole because even when I exit my workbook, if i have other books open within the same instance, it's still laggy.
-It's definitely code-related (as opposed to excessive number of cell formulas, data, autocalc, etc). If I exit and reopen the workbook (along with excel.app), the performance issues are gone and don't arise again until that specific sub is run again.
- It's not the way I'm opening and closing the outside workbooks because i've used the same code for years to extract data from other workbooks without issue.

I guess i'm just wondering if there's anything I should check over.. some kind of application function maybe?

IRish3538
10-17-2012, 02:23 PM
Ok I figured out what was wrong... I'm accessing workbooks that are on a network drive, and I have displayalerts turned off in the sub (so the user doesn't get prompted to save the accessed workbooks upon close)..

what i didn't do was open the workbooks as readonly. so in the event they were openned somewhere else, excel kept querying for the file to notify me when they were available for read/write.

lesson learned, open as readonly unless you're writing to the file.