Hello,
yes I use the dsofile.dll with VB.NET.
I tried with releaseCOMObjec t 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.Prope rtyReader
Dim docProperty As DSOleFile.Docum entProperties
Dim nomeFile As String = "C:\prova\1999d lg135_3.doc"
DSO = New DSOleFile.Prope rtyReader
docProperty = DSO.GetDocument Properties(nome File)
docProperty.Cus tomProperties(" marco").Value = "rossi"
docProperty.Cus tomProperties(" stefano").Value = "sbrulli"
docProperty = Nothing
ReleaseComObjec t(DSO)
Dim mydoc As Word.Document
mydoc = MyWordApp.Docum ents.Open(FileN ame:=nomeFile, ReadOnly:=False ,
Format:=WdOpenF ormat.wdOpenFor matDocument)
Catch ex As Exception
MsgBox(ex.Messa ge)
End Try
Why?
thanks
Marco
"Mike McIntyre" <mi****@dotnets howandtell.com> ha scritto nel messaggio
news:uP******** ******@TK2MSFTN GP12.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.Releas eComObject(your PropertyReaderV a
riable).
You can make a call to ReleaseComObjec t 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******** ******@TK2MSFTN GP14.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
"....Howeve r, 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