From: avkokin on
Hello.
I wonder if there is a way to clear all built-in document properties?
And not for one document but for many into one the folder.
If I will use next code (as example for active document) then I get
the error:
Dim oProp As DocumentProperty
For Each oProp In ActiveDocument.BuiltInDocumentProperties
oProp.Delete
Next
Thank you very much.

From: fumei via OfficeKB.com on
"the error"???? WHAT error? I am guessing you got a Type 13 mis-match error,
or an "Application or object defined error".

1. do not use .Delete
2. BuiltInDocumentProperties is an ENUM, and has items that are not present
in all Office applications. Therefore, use an On Error Resume Next when
iterating through it.
3. if you wish to "clear" the values, then do that.

Like this:

Sub ClearDocProps()
Dim oProp As DocumentProperty
On Error Resume Next
For Each oProp In ActiveDocument.BuiltInDocumentProperties
oProp.Value = ""
Next
End Sub

avkokin wrote:
>Hello.
>I wonder if there is a way to clear all built-in document properties?
>And not for one document but for many into one the folder.
>If I will use next code (as example for active document) then I get
>the error:
>Dim oProp As DocumentProperty
>For Each oProp In ActiveDocument.BuiltInDocumentProperties
> oProp.Delete
>Next
>Thank you very much.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200812/1

From: avkokin on
Yes, I get the error "Run Time...". Thank you very much. All OK.