PC Review


Reply
Thread Tools Rate Thread

Custom Document Properties

 
 
JAC
Guest
Posts: n/a
 
      22nd Oct 2008
Does anyone know how to remove a specified Custom Document Property
from an Excel workbook using VBA?
Adding is easy. There is a method to Add.

I tried to use the Macro Recorder while trying to delete a property
manually, but it did not record anything useful.
Thank you in anticipation.
 
Reply With Quote
 
 
 
 
Carlos
Guest
Posts: n/a
 
      22nd Oct 2008
Hi JAC,

Suppose I already have a custom property named "CustomNumber" in the
workbook object wbk. To erase it just write:

Call wbk.CustomDocumentProperties("CustomNumber").Delete

Custom Properties work like any other collection. You should take a look to
the help file of the collection object.

--
Carlos


"JAC" wrote:

> Does anyone know how to remove a specified Custom Document Property
> from an Excel workbook using VBA?
> Adding is easy. There is a method to Add.
>
> I tried to use the Macro Recorder while trying to delete a property
> manually, but it did not record anything useful.
> Thank you in anticipation.
>

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      22nd Oct 2008
There is also a Delete method. Try something like the following:

Dim DocProps As Office.DocumentProperties
Dim DocProp As Office.DocumentProperty
Set DocProps = ThisWorkbook.CustomDocumentProperties
Set DocProp = DocProps("MyProp") ' Here it is.
Debug.Print DocProp.Value
DocProps.Item("MyProp").Delete ' Now it's gone

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 22 Oct 2008 14:08:26 -0700 (PDT), JAC <(E-Mail Removed)>
wrote:

>Does anyone know how to remove a specified Custom Document Property
>from an Excel workbook using VBA?
>Adding is easy. There is a method to Add.
>
>I tried to use the Macro Recorder while trying to delete a property
>manually, but it did not record anything useful.
>Thank you in anticipation.

 
Reply With Quote
 
JAC
Guest
Posts: n/a
 
      23rd Oct 2008
On 22 Oct, 22:43, Carlos <Car...@discussions.microsoft.com> wrote:
> Hi JAC,
>
> Suppose I already have a custom property named "CustomNumber" in the
> workbook object wbk. To erase it just write:
>
> Call wbk.CustomDocumentProperties("CustomNumber").Delete
>
> Custom Properties work like any other collection. You should take a look to
> the help file of the collection object.
>
> --
> Carlos
>
> "JAC" wrote:
> > Does anyone know how to remove a specified Custom Document Property
> > from an Excel workbook using VBA?
> > Adding is easy. There is a method to Add.

>
> > I tried to use the Macro Recorder while trying to delete a property
> > manually, but it did not record anything useful.
> > Thank you in anticipation.


Thanks guys.

I don't know why I didn't think of that. It's so blindingly obvious
when you think about it.

I hope that others find it useful that the problem has been aired.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Document Properties CarolsXJ900 Microsoft Word Document Management 13 24th Jul 2008 11:21 AM
Re: Custom Document Properties grammatim Microsoft Word Document Management 0 23rd Jul 2008 05:04 AM
Re: Document Properties Custom Tab Jezebel Microsoft Word Document Management 1 20th Jan 2007 01:23 PM
Insert custom document properties into document =?Utf-8?B?UGF1bA==?= Microsoft Word Document Management 1 31st Mar 2006 05:04 PM
Document Properties Custom Tab =?Utf-8?B?Sm9yZ2UgTC4gTWFsZG9uYWRv?= Microsoft Word Document Management 3 20th Dec 2005 09:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:59 AM.