472,344 Members | 1,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

How to: Retrieving BuiltinDocumentProperties from Word Document

Word has a property BuiltinDocumentProperties, which (in VBA) returns a
DocumentProperties collection. In VB.NET, using Word automation, it returns
a _ComObject. I have tried to cast this to DocumentProperties, but I get an
invalid cast exception.

In Explorer, I can right click a Word document, click Properties, and I get
a tabbed dialog with Custom and Summary tabs. These tabs show me the built
in document properties of the document.

I notice that Explorer does this without starting a copy of Word, and it
does it reasonably quickly. The only coded example I have found uses late
binding to retrieve a property by name, but it assumes that I know the name
of the properties in advance.

How can I get at these properties in the same way that Explorer does it,
without starting Word? Also, Explorer can get the properties of a PDF,
without starting Acrobat, so there must be a generic way.

Failing that, how can I use Word automation and early binding to get them?

Any thoughts?

TIA

Charles
Jan 28 '06 #1
3 5482
On Sat, 28 Jan 2006 09:23:49 -0000, "Charles Law" <bl***@nowhere.com> wrote:

¤ Word has a property BuiltinDocumentProperties, which (in VBA) returns a
¤ DocumentProperties collection. In VB.NET, using Word automation, it returns
¤ a _ComObject. I have tried to cast this to DocumentProperties, but I get an
¤ invalid cast exception.
¤
¤ In Explorer, I can right click a Word document, click Properties, and I get
¤ a tabbed dialog with Custom and Summary tabs. These tabs show me the built
¤ in document properties of the document.
¤
¤ I notice that Explorer does this without starting a copy of Word, and it
¤ does it reasonably quickly. The only coded example I have found uses late
¤ binding to retrieve a property by name, but it assumes that I know the name
¤ of the properties in advance.
¤
¤ How can I get at these properties in the same way that Explorer does it,
¤ without starting Word? Also, Explorer can get the properties of a PDF,
¤ without starting Acrobat, so there must be a generic way.
¤
¤ Failing that, how can I use Word automation and early binding to get them?

See if the following helps:

How To Use Automation to Get and to Set Office Document Properties with Visual Basic .NET
http://support.microsoft.com/default...b;en-us;303294
Paul
~~~~
Microsoft MVP (Visual Basic)
Jan 30 '06 #2
Hi Paul

Thanks for the reply. It's actually this article that I am using as my
starting point.

In the article, Word is launched and a /known/ parameter - Author - is read.
Everything is done using late binding, and I would like to use early binding
because I always have Option Strict On.

Also, it presupposes that I know which properties I want to read, when, in
fact, I just want to get a list of the existing ones (and any custom
properties) to display to the user.

Thirdly, it is very slow, having to launch Word just to read these
properties. It would be nice to know how Explorer can do it so much more
quickly.

Charles
"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:1h********************************@4ax.com...
On Sat, 28 Jan 2006 09:23:49 -0000, "Charles Law" <bl***@nowhere.com>
wrote:

¤ Word has a property BuiltinDocumentProperties, which (in VBA) returns a
¤ DocumentProperties collection. In VB.NET, using Word automation, it
returns
¤ a _ComObject. I have tried to cast this to DocumentProperties, but I get
an
¤ invalid cast exception.
¤
¤ In Explorer, I can right click a Word document, click Properties, and I
get
¤ a tabbed dialog with Custom and Summary tabs. These tabs show me the
built
¤ in document properties of the document.
¤
¤ I notice that Explorer does this without starting a copy of Word, and it
¤ does it reasonably quickly. The only coded example I have found uses
late
¤ binding to retrieve a property by name, but it assumes that I know the
name
¤ of the properties in advance.
¤
¤ How can I get at these properties in the same way that Explorer does it,
¤ without starting Word? Also, Explorer can get the properties of a PDF,
¤ without starting Acrobat, so there must be a generic way.
¤
¤ Failing that, how can I use Word automation and early binding to get
them?

See if the following helps:

How To Use Automation to Get and to Set Office Document Properties with
Visual Basic .NET
http://support.microsoft.com/default...b;en-us;303294
Paul
~~~~
Microsoft MVP (Visual Basic)

Jan 30 '06 #3
For anyone wondering how this is done, the answer is IPropertyStorage.

The following link leads to an article and ActiveX control that does the
job:

http://support.microsoft.com/?id=224351

Charles
"Charles Law" <bl***@nowhere.com> wrote in message
news:%2*****************@TK2MSFTNGP15.phx.gbl...
Word has a property BuiltinDocumentProperties, which (in VBA) returns a
DocumentProperties collection. In VB.NET, using Word automation, it
returns a _ComObject. I have tried to cast this to DocumentProperties, but
I get an invalid cast exception.

In Explorer, I can right click a Word document, click Properties, and I
get a tabbed dialog with Custom and Summary tabs. These tabs show me the
built in document properties of the document.

I notice that Explorer does this without starting a copy of Word, and it
does it reasonably quickly. The only coded example I have found uses late
binding to retrieve a property by name, but it assumes that I know the
name of the properties in advance.

How can I get at these properties in the same way that Explorer does it,
without starting Word? Also, Explorer can get the properties of a PDF,
without starting Acrobat, so there must be a generic way.

Failing that, how can I use Word automation and early binding to get them?

Any thoughts?

TIA

Charles

Jan 30 '06 #4

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

Similar topics

5
by: Jeffrey Bradshaw | last post by:
Hey everybody, I've got a VB.NET program that is trying to access a Word document and I'm having all kinds of trouble. First on is the above. I'm...
3
by: Charles Law | last post by:
Word has a property BuiltinDocumentProperties, which (in VBA) returns a DocumentProperties collection. In VB.NET, using Word automation, it returns...
5
by: znubbe | last post by:
Hi, I hope anyone can help me with this problem. I have a field of image type in a SQL 2000 database. I'm using this code to insert a...
11
by: Peter Afonin | last post by:
Hello, I have Word documents stored in the Oracle database in the BLOB field that I need to retrieve. I've found the way of doing it: While...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the...
3
by: =?Utf-8?B?Tmljaw==?= | last post by:
Hi all, i have a web application and one of the function is to generate a word document by button click. it works fine in debug mode when i run...
0
by: ahammad | last post by:
My application opens up a blank Word doc for editing. When I am done editing, I save the file and exit Word. All this will be done while the...
1
by: ahammad | last post by:
This application opens a Word document for editing. I need to keep the file path of the Word document even after it has been closed. I tried using...
2
by: dmj07 | last post by:
Hi, I need some help retrieving documents I have inserted into SQL in an Image type field. What I want to get is that when the user clicks the...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.