A couple of points:
1. Files in the docx format cannot contain macros, so there isn't one in your attachment.
2. Files using content controls don't need forms protection, so that's not necessary unless you have other reasons for using it.
As for the macro, you could run it via Alt-F11, or you could rename it to:
Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
insert as the first line:
If ContentControl.Title <> "MyTitle" Then Exit Sub
and place the code in your document's 'ThisDocument' code module. You would then apply the title 'MyTitle' to whatever content control you want to run the macro from. You can, of course, use something other than 'MyTitle' in both the code and the document.
If you don't want the password prompt, you could replace:
Pwd = InputBox("Please enter the Password", "Password")
with:
Pwd = "123"
That said, if all you want to achieve is having the content of one of your content controls replicated in the header, you don't need a macro. All you need do is apply a unique character Style to the content control, then use a STYLEREF field in the header to reference that Style.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
|