Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Document Properties

Status
Not open for further replies.

dmard

Programmer
Nov 26, 2001
4
IN
Hello,
I'm trying to develop an application in VC++ 6.0 that
needs to read the custom properties of an Excel 2000
document. There is a function GetCustomDocumentProperties
() in Excel9.olb but I'm not quite sure what its return type is. Could anyone let me know how to use it?

Thanks.


 
The following VBA code will access the custom properties of an Excel workbook (the active workbook in this example).
Code:
Dim r As Integer
Dim DocProp As DocumentProperty
For Each DocProp In ActiveWorkbook.CustomDocumentProperties
    [A1].Offset(r, 1).Value = DocProp.Name
    [A1].Offset(r, 2).Value = DocProp.Value
    r = r + 1
Next
There is also a BuiltinDocumentProperties collection which can be accessed in the same way, except that in some cases trying to query the Value causes an error if it is not set.

What may be of more interest to is a dll that is freely available which enables querying and even editing of document properties. Check out MS KB article Q224351 ( and download Dsofile.exe. Install and register the dll. There is a VB example of its use, which may help you.

A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top