Dsframer activex releasing COM object

selvamarcadu

Member
Joined
Jul 7, 2009
Messages
17
Programming Experience
Beginner
Hi all,

I am using Dsoframer activex control to host office documents.I add the acitvex control dynamically and set an event handler for document close so that i can release the com object.

AddHandler AxFramerControl1.OnDocumentClosed, AddressOf AxFramerControl1_OnDocumentClosed

The call due to the event OnDocumentClosed only gets fired after the document inside my activex(Dsoframer) gets closed.So when i try to release the com object it says "NO document opened to perform the operation requested".


Public Sub AxFramerControl1_OnDocumentClosed(ByVal sender As AxDSOFramer.AxFramerControl, ByVal e As System.EventArgs)
Dim oDoc As Word.Document
oDoc = sender.ActiveDocument
oDoc.Close()
oDoc = Nothing
End Sub

Without releasing the COM object, it will cause the process to run in the background.(eg WINWORD.EXE).
I would like to get some support from you.




Thanks,
Selvam
 
Using the Interop:

VB.NET:
wrdApp = New Microsoft.Office.Interop.Word.Application

wrdApp.Documents.Open(FilePath)

wrdApp.Quit(SaveChange)

Marshal.ReleaseComObject(wrdApp)

Close will close the document but I found I needed to use the Quit command to exit Word.
 
Back
Top