Loop to Delete All Custom Properties Deletes Every Other One
  
PSS ID Number: Q141416
Article last modified on 01-02-1996
 
4.10
 
WINDOWS
 

--------------------------------------------------------------------
The information in this article applies to:
 
 - Microsoft Project for Windows, version 4.1
--------------------------------------------------------------------
 
SYMPTOMS
========
 
Using a For...Each loop in a macro to delete all custom properties only
deletes every other one. Note: You can view the custom properties
associated with a file by clicking Properties from the File menu, and
clicking the Custom tab.
 
WORKAROUND
==========
 
To ensure that your macro deletes the specified range of Custom Properties,
use a For...Next loop instead of For...Each loop. To index the last Custom
property of the document, use the Count property of the
CustomDocumentProperties collection as in the following example:
 
   For i = 1 to ActiveProject.CustomDocumentProperties.Count
     'Place the statements needed to delete properties here
   Next i
 
REFERENCES
==========
 
For more information about a For...Next loop, click the Index tab in
Microsoft Project Help, type the following text
 
   for
 
and then double-click the selected text to go to the "For...Next Statement"
topic.
 
For more information about CustomDocumentProperties, click the Index tab in
Microsoft Project Help, type the following text
 
   CustomDocumentProperties
 
and then double-click the selected text to go to the
"CustomDocumentProperties Property" topic.
 
KBCategory:  kbprg kbcode
KBSubcategory:
 
Additional reference words: 4.10 foreach for each
=============================================================================
Copyright Microsoft Corporation 1996.
