Roman Benko

I am working with Orcas and VSTO Beta 1. I created a new Word document project called TestWord that contains a custom ribbon. If a user has multiple Word documents open at any given time, how can I loop through them and determine which ones, if any, are my custom type containing the ribbon Thanks.



Re: Visual Studio Tools for Office Looping Through Open Word Documents

Cindy Meister

It might be better to ask this in the Orcas VSTO forum, but in a VSTO 2005 for Word 2003 document-level project there's an OLE Control belonging to the Shapes collection of the OLE Class

ActiveDocument.Shapes(1).OLEFormat.ClassType
VSTO.RuntimeStorage.1

Assuming the VSTO team has kept the same approach for 2007, you can loop through the Shapes collection of a document, testing the OLEFormat.ClassType whether it's VSTO.RuntimeStorage.1 (or perhaps better, check whether this value "Contains" VSTO.RuntimeStorage in case the application version has changed).