I am trying to update the header and footer size on a large number of Word documents within sub-folders. The macro I am using is as below:
Code:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
With Selection.PageSetup
.HeaderDistance = CentimetersToPoints(2.6)
.FooterDistance = CentimetersToPoints(2.6)
End With
This works, however I need to run it on many documents. I have found a batch processes add-in from gmayor
Graham Mayor - Home Page
I have placed the code into a function so it can be used as a custom process within the add-in. The process runs with no errors but when I open the amended documents the header/footer appears unchanged. I'm not sure why as it will work when manually ran. Hoping someone can assist.
Code:
Function HeaderFooter(oDoc As Document) As Boolean
On Error GoTo Err_Handler
'Do Something with oDoc here. e.g.,"
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
With Selection.PageSetup
.HeaderDistance = CentimetersToPoints(2.6)
.FooterDistance = CentimetersToPoints(2.6)
End With
HeaderFooter = True
lbl_Exit:
Exit Function
Err_Handler:
Select Case Err.Number
'Case Is = "Your handled errors e.g., 5109"
Case Else
HeaderFooter = False
Resume lbl_Exit
End Select
End Function
Thanks