A
Allov
Hi,
I'm having trouble detecting if a document has been closed using .Net and
the Word Object Library 12.0.
Imagine a wraper for the :
Public Class WordWraper
Private word As New Word.Application()
Private doc As Word.Document = word.Documents.Open("C:\test.doc")
Public Sub SaveAndClose()
doc.Save()
doc.Close()
End Sub
Public Sub Dispose(...)
' Some verification of the object to check if it exists or not equals
nothing.
doc.Close() ' Here, it will crash with error RPC_E_DISCONNECTED.
doc = Nothing
End Sub
End Class
In the dispose method, it's going to crash if the object has been closed
before. I could put a flag "hasBeenClosed" in this class and test this flag
before doing the last close operation, but I'm hoping there's a way to check
for that in the API itself?
Thanks a lot
Allov
I'm having trouble detecting if a document has been closed using .Net and
the Word Object Library 12.0.
Imagine a wraper for the :
Public Class WordWraper
Private word As New Word.Application()
Private doc As Word.Document = word.Documents.Open("C:\test.doc")
Public Sub SaveAndClose()
doc.Save()
doc.Close()
End Sub
Public Sub Dispose(...)
' Some verification of the object to check if it exists or not equals
nothing.
doc.Close() ' Here, it will crash with error RPC_E_DISCONNECTED.
doc = Nothing
End Sub
End Class
In the dispose method, it's going to crash if the object has been closed
before. I could put a flag "hasBeenClosed" in this class and test this flag
before doing the last close operation, but I'm hoping there's a way to check
for that in the API itself?
Thanks a lot
Allov