View Single Post
 
Old 02-04-2015, 06:44 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote