Writing a VS.NET Addin
-
I have written an add-in using VB.NET. Yipeee! OK, I've calmed down now! My add-in inserts some code which I wrap in a #region declaration and I want to automatically collapse the region to hide the generated code to keep the developers code in view as much as possible. Has anybody done this? I have tried using the Collapse and OutlineSection but I dont know if I am setting myself up in the text selection object correctly... ' Get a text object Dim lText As TextSelection = CType(applicationObject.ActiveDocument.Selection, TextSelection) ' Move to the beginning of the document so we can iterate over the whole thing. lText.StartOfDocument() If lText.FindPattern(mRegionHeader) Then lText.WordLeft() lText.OutlineSection() lText.Collapse() End If Any ideas would be warmly welcomed. Nursey