GetVSTOObject

You can get a VSTO host item from the PIA object for a Document using the GetVSTOObject method.
VSTO uses a new language feature called extension methods to extend the Microsoft.Office.Interop.Excel.Workbook with a method called GetVSTOObject.





Dim vstoDocument As Microsoft.Office.Tools.Word.Document 
vstoDocument = Globals.ThisAddin.Application.ActiveDocument.GetVSTOObject

You should use the ShutDown event on the document for a Close event as this is fired after any "do you want to save" dialog boxes



© 2018 Better Solutions Limited. All Rights Reserved. © 2018 Better Solutions Limited TopPrevNext