i've been googling my eyes out and i'm very much a novice.
I'm using a macro to run through a list of customer id, filter a pivot with the id, export a sheet as pdf then repeat the loop.
I have finally after several days managed to get it to run for 60 times but about then it restarts excel. I have just increased the pagefile from 2gb to 16gb.
I'm using a do while loop and im trying to set objects = nothing to clean up resources and im saving the file at one point and i also am using DoEvents, set screenupdate to false, set microsoft xps as default printer, print comms to false, all ranges are stores in variables instead of selected, worksheets are also stored in variables instead of being activated. I have tried stepping through, using breakpoints etc... and seeing as it runs 60 times without errors..
My guess is that since it's upped from 40 to 60 before crash that it might have to do with resources being bloated over time.
Removed code as i found out the crashing had nothing to do with the VBA code, but linked images.
See Question&Answers more detail:os