spoolsv.exe consuming CPU when adding content to Excel worksheet from VBA

Hi,

I have a VBAmacro under Excel. I am adding a lot of content to a number of worksheets and have found it to be very slow.

When I check Task Manager, there is a process "spoolsv.exe" that is consuming a stack of CPU time. If I kill it off, my macro runs like lightning.

Why would adding content to Excel worksheets cause a spoolsv.exe call anyway - isnt that related to printing?

Any suggestion as to how I can avoid spoolsv.exe from being called when I update the cells would be appreciated

Cheers

Greg
gbergsmaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ExcelGuideConsultantCommented:
Removing and adding rows is changing the page layout for printing purposes, that why it is getting bigger. I dont think there is a workaround for this, but read this link:
http://www.ozgrid.com/forum/showthread.php?t=73446

it might help you out.

im not sure if the same problem exist in excel 2007 (or 2002)
0
gbergsmaAuthor Commented:
OK. I have a workaround. Hopefully it helps anyone else with this issue.

1. I create new worksheet
2. I add all my content (including page breaks)
3. I set all the print layout stuff (paper size, zoom, fit per page, borders etc) - DO THIS LAST!

Originally I had copied a sheet with all the print layout stuff set up. Step 2 above took an eternity, with spoolsv.exe taking a huge amount of CPU.

It seems spoolsv.exe only gets called if Excel has to rework the print layout. If it doesnt know what the layout is, it doesnt call out to spoolsv. So, starting with a new sheet (ie. the print layout is undefined), and setting the print layout after filling out the cells in the sheet has made my printing well over 10 times as fast.

Cheers

Greg
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.