View Single Post
 
Old 01-16-2024, 02:40 AM
ADAL ADAL is offline Windows 10 Office 2021
Novice
 
Join Date: Dec 2023
Posts: 26
ADAL is on a distinguished road
Default How to lock fields with vba just in header, not in footer

Hello, as you know, in large documents that have variable headers [STYLEREF], Word becomes very slow, so the solution is to lock the fields, and after that open them (close to printing, etc.).
I do it with the command:
Code:
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields.Locked = False
ActiveDocument.Sections(1).Headers(wdHeaderFooterEvenPages).Range.Fields.Locked = False
The problem is that this macro also locked in footers, and I only need it in the upper headings [I know that I can add a command that will unlock the footers, but for a reason that is a bit complicated to explain, it is not relevant in my case] I am wondering how it is possible to give the command directly only to headers
Thanks
Reply With Quote