473,574 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to: Retrieving BuiltinDocument Properties from Word Document

Word has a property BuiltinDocument Properties, which (in VBA) returns a
DocumentPropert ies collection. In VB.NET, using Word automation, it returns
a _ComObject. I have tried to cast this to DocumentPropert ies, 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 5603
On Sat, 28 Jan 2006 09:23:49 -0000, "Charles Law" <bl***@nowhere. com> wrote:

¤ Word has a property BuiltinDocument Properties, which (in VBA) returns a
¤ DocumentPropert ies collection. In VB.NET, using Word automation, it returns
¤ a _ComObject. I have tried to cast this to DocumentPropert ies, 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************ ***********@sws pectrum.com> wrote in message
news:1h******** *************** *********@4ax.c om...
On Sat, 28 Jan 2006 09:23:49 -0000, "Charles Law" <bl***@nowhere. com>
wrote:

¤ Word has a property BuiltinDocument Properties, which (in VBA) returns a
¤ DocumentPropert ies collection. In VB.NET, using Word automation, it
returns
¤ a _ComObject. I have tried to cast this to DocumentPropert ies, 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 IPropertyStorag e.

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******** *********@TK2MS FTNGP15.phx.gbl ...
Word has a property BuiltinDocument Properties, which (in VBA) returns a
DocumentPropert ies collection. In VB.NET, using Word automation, it
returns a _ComObject. I have tried to cast this to DocumentPropert ies, 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
4641
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 trying to get the number of lines in the document and when I try docWord.BuiltInDocumentProperties("NUMBER OF LINES") it returns an Object. When I look in the debugger, it is of type...
3
9838
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 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...
5
2043
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 document: Dim conn Dim rs Dim oStream
11
3916
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 dr.Read sName = dr("TE_PM_ATTACH_NAME") bLob = dr.GetOracleLob(1)
4
12426
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 data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
3
14497
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 this web application. But after i deploy to my local IIS server, it always show this error when i click the button which trying to generate a word document. Error msg:
0
1347
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 application is still running. Is there a way to get the file path of the Word document after it has been saved? For example, if I opened a blank file and added two lines of text, then clicked Save As and...
1
2986
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 Word event handlers but I couldn't figure it out, so I came up with this solution: _Application wordAppBlank; CString idBlank("Word.Application"); BOOL statusBlank =...
2
1990
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 view button it retrieves the document in the format it was saved as. Code is below: SqlConnection connSQL = new SqlConnection(conn); connSQL.Open(); SqlCommand cmdHeader = new SqlCommand("SELECT...
0
7741
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8085
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8259
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8126
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6491
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5637
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3781
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1090
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.