O'Reilly logo

Microsoft® Visual Studio® 2010 Unleashed by Lars Powers, Mike Snell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required