I've had this piece of code in my Personal macro file for years and I've never had any issues with it:
Sub Header_Footer()
' Set centre header to display worksheet name and centre footer to
'display network file path and workbookname
With ActiveSheet.PageSetup
.CenterHeader = "Worksheet name: &A"
.CenterFooter = "Filepath: &Z&F"
End With
ActiveSheet.PrintPreview
End Sub
I've just tried to run it against a workbook someone else sent to me, and I got the error message in the title.
When I debug, it highlights the:
.CenterHeader = "Worksheet name: &A"
line
Any thoughts what could be causing this?
Bookmarks