473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

DSOleFile.dll use in VB.NET

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
Nov 20 '05 #1
3 3544
Hi,

System.Runtime.InteropServices.Marshal.ReleaseComO bject(oDocProp)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(oFilePropReader)

Ken

--------------------------

"Steve Lang" <no*****@Nohow.not> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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

Nov 20 '05 #2
Thanks Ken - works like a champ!

Steve
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uV**************@tk2msftngp13.phx.gbl...
Hi,

System.Runtime.InteropServices.Marshal.ReleaseComO bject(oDocProp)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(oFilePropReader)

Ken

--------------------------

"Steve Lang" <no*****@Nohow.not> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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


Nov 20 '05 #3
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
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uV**************@tk2msftngp13.phx.gbl...
Hi,

System.Runtime.InteropServices.Marshal.ReleaseComO bject(oDocProp)

System.Runtime.InteropServices.Marshal.ReleaseComO bject(oFilePropReader)

Ken

--------------------------

"Steve Lang" <no*****@Nohow.not> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: | last post by:
I am using Microsoft's dsofile (http://support.microsoft.com/support/kb/articles/Q224/3/51.asp) in an ASP to update a set of custom properties in a Word document. The document properties are always...
14
by: Curtis Tammany | last post by:
Hello- Can someone tell me if DSOFile.dll can be accessed within ASP.NET? DSOFile.dll is registered and I have no problem using it in my .ASP scripts. I have tried the following: Dim...
4
by: Craig | last post by:
I'm trying to build a filter for a file search where the search will be able to filter out certain files according to certain "file properties", like Owner, Creation Date, etc. MS does this in...
0
by: Jason | last post by:
I am porting some legacy services to C# and .NET. I have run across two issues with using DSOLEFILE in .NET, and was hoping somebody might shed some light... 1. Access Files Across the Network...
0
by: Robert | last post by:
Somebody converted the DSOlefile ( dsofile.dll ) example to VB.Net ? It seems that the automatic conversion is NOT complete correct ! I received all (Ms-Office) document properties...
0
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a...
2
by: Marco | last post by:
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...
4
by: Paul Bromley | last post by:
I have been pondering over this one all night!! I want to read the properties of a Word document WITHOUT opening it - notably the title document. Having read the newsgroups it seems that I neede to...
0
by: Henrik | last post by:
Hi, I'm trying to set CustomProperties through the newer version of the DSOleFile (2.x) object for Word, Excel and PowerPoint documents. For some reason it seems that when I'm trying to set a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.