DSOleFile.dll use in VB.NET

  • Thread starter Thread starter Steve Lang
  • Start date Start date
S

Steve Lang

Hi all,

I am trying to use the DSOleFile.dll in my VB.NET application (that I am
converting from VB6) to extract some property data from a Word document
before the application processes the file. The key feature of the dll is
that it allows the data to be extracted without the document opening in
Word; I successfully used it in VB6 without a problem.

Under .NET, however, after I use a function that calls the dll, the function
appears to keep the file open, so my app can't delete it as it is supposed
to. The code is below:

Private oFilePropReader As DSOleFile.PropertyReader

Private oDocProp As DSOleFile.DocumentProperties

'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Public Function getLastEditProperty(ByVal strDoc As String) As String

Dim oFilePropReader As New DSOleFile.PropertyReader

oDocProp = oFilePropReader.GetDocumentProperties(cXFer & strDoc & ".doc")

getLastEditProperty = oDocProp.LastEditedBy

oDocProp = Nothing

oFilePropReader = Nothing

End Function


Anybody have any ideas on how to force a release? Am fairly new to .NET...
is there something I am missing?

TIA and have a great day!

Steve Lang
 
Hi,

System.Runtime.InteropServices.Marshal.ReleaseComObject(oDocProp)

System.Runtime.InteropServices.Marshal.ReleaseComObject(oFilePropReader)



Ken
 
Thanks Ken - works like a champ!

Steve


Ken Tucker said:
Hi,

System.Runtime.InteropServices.Marshal.ReleaseComObject(oDocProp)

System.Runtime.InteropServices.Marshal.ReleaseComObject(oFilePropReader)



Ken
 
Hi Ken,

Thanks! The code works on my development machine. However, when I try to run
it on the target computer, I am getting errors regarding the DSOLEFile.dll.
Specifically: "The format of the file 'Interop.DSOleFile.dll' is invalid."
I don't understand what the difference is between the development computer
where I wrote the code and it works, and the target machine where it NEEDS
to work! I registered the dll successfully, so I don't think that is the
issue. Any ideas anyone?

TIA,

Steve
 
I have problems logging

Hello! Help solve the problem.
Very often try to enter the forum, but says that the password is not correct.
Regrettably use of remembering. Give like to be?
Thank you!
 
Back
Top