Hello,
yes I use the dsofile.dll with VB.NET.
I tried with releaseCOMObject but the problem is not resolved.
When I open the document that I have modified with the propertyReader an
error occurs.
Try
Dim DSO As DSOleFile.PropertyReader
Dim docProperty As DSOleFile.DocumentProperties
Dim nomeFile As String = "C:\prova\1999dlg135_3.doc"
DSO = New DSOleFile.PropertyReader
docProperty = DSO.GetDocumentProperties(nomeFile)
docProperty.CustomProperties("marco").Value = "rossi"
docProperty.CustomProperties("stefano").Value = "sbrulli"
docProperty = Nothing
ReleaseComObject(DSO)
Dim mydoc As Word.Document
mydoc = MyWordApp.Documents.Open(FileName:=nomeFile, ReadOnly:=False,
Format:=WdOpenFormat.wdOpenFormatDocument)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Why?
thanks
Marco
"Mike McIntyre" <mi****@dotnetshowandtell.com> ha scritto nel messaggio
news:uP**************@TK2MSFTNGP12.phx.gbl...
Hi Marco,
That MSDN article is for VB6 but I see you are using GC.Collect. Are you
trying to use DSOFile.dll in VB.NET?
If so check out
System.Runtime.InteropService.Marshall.ReleaseComO bject(yourPropertyReaderVa
riable).
You can make a call to ReleaseComObject as soon as you are finished with
the reader.
--
Mike
Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Marco" <co***@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP14.phx.gbl... Hello,
I have to use the propertyReader of DSOFile.dll for reading/writing
custom document properties in a closed document.
In the msdn http://support.microsoft.com/?scid=kb;en-us;Q224351
"....However, to save resources at run time, it is recommended that you
explicitly create and destroy a PropertyReader object when needed. If
you allow Visual Basic to implicitly create the object, it is not released
until
your application terminates....."
Now I 'm not able to destroy the object so if I try to open the document
immediately after, a message error occurs (the file is used).
I tried to use the garbage collector
GC.Collect
but sometime the document is still used.
It's possible that don't exists a way to destroy the propertyReader
object?
Thank you
Marco