View Single Post
 
Old 02-04-2015, 03:18 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,373
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

You could do that with code like:
Code:
Sub ModifyHeader()
Application.ScreenUpdating = False
Dim Pwd As String, pState As Variant, Rng As Range, StrTxt As String
With ActiveDocument
  Set Rng = .Sections(1).Headers(wdHeaderFooterPrimary).Range
  Rng.End = Rng.End - 1
  StrTxt = InputBox("Please input the modified header text.", "Header Update", Rng.Text)
  If Trim(StrTxt) = "" Then Exit Sub
  pState = False
  If .ProtectionType <> wdNoProtection Then
    Pwd = InputBox("Please enter the Password", "Password")
    pState = .ProtectionType
    .Unprotect Pwd
  End If
  Rng.Text = StrTxt
  If pState <> wdNoProtection Then .Protect Type:=pState, NoReset:=True, Password:=Pwd
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote