Learn how to a build a cloud-first strategyRegister Now


How to save watch list in Excel 2010 VBA ?

Posted on 2014-08-13
Medium Priority
Last Modified: 2014-08-14

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.

Question by:slobber72
LVL 23

Expert Comment

ID: 40260764
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!
LVL 50

Accepted Solution

Martin Liss earned 1500 total points
ID: 40260883
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.

Author Closing Comment

ID: 40262004
Thanks for the feedback. I think I will rethink how I use debug print for this particular instance.


Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question