How to save watch list in Excel 2010 VBA ?


I was hoping there was a way to either save or programmatically add variables to the watch list in Excel VBA ?

I just have a procedure with a fair few variables (like 25) and I don't want to add them everytime I open this file and continue programming and debugging it.

Any help appreciated.

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.

The object model doesn't have any way (AFAIK) of addressing the Watch window so I think it is impossible to do what you need. Hope I'm wrong!
Martin LissOlder than dirtCommented:
Unfortunately there's no way to do that with VBA while you are debugging Excel. Probably the best that you could do if the variables have global scope (or you change them so that they are global) would be to write a sub that contains a list of Debug.Print statements for each variable you are interested in. At that point you could simulate a "Watch Expression" watch by setting a breakpoint and calling that sub from the Immediate Window.

If you are interested here's a link to an article I wrote on debugging.

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
slobber72Author Commented:
Thanks for the feedback. I think I will rethink how I use debug print for this particular instance.

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
Microsoft Excel

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.