Bonjour,
Dans son message, < Ed G. > écrivait :
In this message, < Ed G. > wrote:
|| I am trying to create a macro that will delete the entry
|| in the Password to modify field (found under: Save As,
|| Tools, Security). But my macro will not remove the
|| contents of the field. It leaves the password in place.
||
|| I am recording the macro.
||
Play around with the following code to get what you need. Once in the VBE,
select a property/method/object and hit F1 to get more info. Also, hit F2 to
access the object browser to look for methods/properties or objects.
Careful with the macro recorder. It is useful to see what method/property
you need but it is very context sensitive. A recorded macro will very often
fail when run as is in a different document or under new circumstances. You
almost always have to rework it or at least remove all the extra code the
recorder includes.
'_______________________________________
ActiveDocument.Password = "123abc"
If ActiveDocument.HasPassword Then _
MsgBox "The password is set."
ActiveDocument.Password = ""
ActiveDocument.WritePassword = "abc123"
If ActiveDocument.WriteReserved Then _
MsgBox "The modify password is set."
ActiveDocument.WritePassword = ""
'_______________________________________
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org