Writing a Macro
If you revisit the code in Listing 14.1 that was generated for you when you recorded your Solution Explorer node expansions, you can see that it is straightforward, and represents a verbatim replay of what you manually accomplished in the Solution Explorer window. The macro references each individual item in the Explorer window by using the ActiveWindow.Object.GetItem method, passing in the object’s name to get a UIHierarchyItem reference. From there, it is a simple property set to expand all the items below (by setting UIHierarchyItems.Expand = True).
The code is complete and works, but it’s probably not exactly what you were looking for. For instance, it references the projects and project items that you expanded by their path ...
Get Microsoft® Visual Studio® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.