Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 02-04-2015, 06:44 PM
macropod's Avatar
macropod macropod is offline Can I modify header after form protection Windows 7 64bit Can I modify header after form protection 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I modify header after form protection One header without modify footers tanias Word 2 06-30-2014 11:55 AM
Can I modify header after form protection form field in header Snvlsfoal Word 1 07-12-2011 03:19 AM
How to remove this paragraph (line) form the header? Jamal NUMAN Word 1 04-14-2011 06:35 AM
Document protection Daved2424 Word 0 11-17-2010 01:22 AM
Form field to automatically be added to header? razberri Word VBA 3 02-22-2010 03:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft