Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Accessing custom document properties

Anyone know of a way to access and display the custom
document properties in Excel?

Thanks ...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Accessing custom document properties


"Tim Haley" wrote in message
...
Anyone know of a way to access and display the custom
document properties in Excel?

Thanks ...



To iterate through all document properties and add them
to a list box

Dim dp As DocumentProperty

For Each dp In ActiveWorkbook.CustomDocumentProperties
ListBox1.AddItem dp.Name
Next dp


To create a new document property
Set dp = ActiveWorkbook.CustomDocumentProperties.Add(Name:= "adpass",
LinkToContent:=False, _
Type:=msoPropertyTypeString, value:="")

To set an existing property

ActiveWorkbook.CustomDocumentProperties("adpass") = "Hello World"

To delete a document properties
Dim dp As DocumentProperty

For Each dp In ActiveWorkbook.CustomDocumentProperties
if dp.Name="adpass" then
dp.Delete
End If
Next dp

Keith


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Accessing custom document properties

Thanks Keith ...

This will work fine. Too bad Microsoft doesn't support
built-in Excel functions that access custom document
properties like Word field tags. Job security for those of
us who know how to progam in VB I suppose!

Tim
-----Original Message-----

"Tim Haley" wrote in message
...
Anyone know of a way to access and display the custom
document properties in Excel?

Thanks ...



To iterate through all document properties and add them
to a list box

Dim dp As DocumentProperty

For Each dp In ActiveWorkbook.CustomDocumentProperties
ListBox1.AddItem dp.Name
Next dp


To create a new document property
Set dp = ActiveWorkbook.CustomDocumentProperties.Add

(Name:="adpass",
LinkToContent:=False, _
Type:=msoPropertyTypeString, value:="")

To set an existing property

ActiveWorkbook.CustomDocumentProperties("adpass ")

= "Hello World"

To delete a document properties
Dim dp As DocumentProperty

For Each dp In ActiveWorkbook.CustomDocumentProperties
if dp.Name="adpass" then
dp.Delete
End If
Next dp

Keith


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Document Properties Bauhinia Excel Discussion (Misc queries) 1 October 23rd 07 12:33 PM
Properties of a document, help! Jason Excel Worksheet Functions 2 February 24th 06 10:47 AM
How can I using Excel custom document properties in the header? ecalvo Excel Worksheet Functions 4 November 3rd 05 09:29 PM
Document Properties Barb R. Excel Worksheet Functions 5 May 23rd 05 04:55 PM
Accessing properties of a series with no data Tom Ogilvy Excel Programming 0 August 1st 03 06:09 PM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"