E
Eric F.
As part of an automated document cleanup process, I created a VBA userform
that lets the user select up to 14 kinds of things to be removed from a Word
document (tracked changes, comments, hidden text, etc.) This is kind of an
ersatz Remove Hidden Data tool.
I would like to be able to include in this form the option to remove any
custom document properties that have been set in a Word document before we
send the document outside the office. We sometimes send many dozens of files
at once and each may have many custom document properties set for it. We have
received files from outside the office that contained custom document
properties that I know the sender would not have wanted us to see and I want
to make sure we avoid that same problem.
The problem is I can't find a way to automatically remove all custom
properties. These can be of two kinds: the custom document properties that
are already in the document (from the template - I can manually delete the
value but the name remains) and those created by document users (I can
manually delete both the property name and the value for these). While it is
quite easy to add new custom document properties and property values with
VBA, I cannot find a way to automatically delete all custom document
properties or their values. I can automatically remove the values for those
custom document properties that are in the template (since I know each
property's name) but I cannot find a way to delete or at least remove the
value for a custom property created by a user. It would be sufficient for me
to reset the value of a user-created custom document property to no data or a
space or some other text, but I have been unable to get anything to work.
Although just removing the value might leave the user-created custom property
name visible in the document properties, at least the value would be gone. At
this point, I don't need to choose to keep any custom document properties. It
appears that it will be sufficient to just remove all and I don't need the
option to preserve some of the custom properties for the files we send out. I
have searched several groups and through the VBA help but can't find a
solution. I would appreciate help with some VBA code that would handle all
the custom document properties. Thanks.
that lets the user select up to 14 kinds of things to be removed from a Word
document (tracked changes, comments, hidden text, etc.) This is kind of an
ersatz Remove Hidden Data tool.
I would like to be able to include in this form the option to remove any
custom document properties that have been set in a Word document before we
send the document outside the office. We sometimes send many dozens of files
at once and each may have many custom document properties set for it. We have
received files from outside the office that contained custom document
properties that I know the sender would not have wanted us to see and I want
to make sure we avoid that same problem.
The problem is I can't find a way to automatically remove all custom
properties. These can be of two kinds: the custom document properties that
are already in the document (from the template - I can manually delete the
value but the name remains) and those created by document users (I can
manually delete both the property name and the value for these). While it is
quite easy to add new custom document properties and property values with
VBA, I cannot find a way to automatically delete all custom document
properties or their values. I can automatically remove the values for those
custom document properties that are in the template (since I know each
property's name) but I cannot find a way to delete or at least remove the
value for a custom property created by a user. It would be sufficient for me
to reset the value of a user-created custom document property to no data or a
space or some other text, but I have been unable to get anything to work.
Although just removing the value might leave the user-created custom property
name visible in the document properties, at least the value would be gone. At
this point, I don't need to choose to keep any custom document properties. It
appears that it will be sufficient to just remove all and I don't need the
option to preserve some of the custom properties for the files we send out. I
have searched several groups and through the VBA help but can't find a
solution. I would appreciate help with some VBA code that would handle all
the custom document properties. Thanks.