Forum Discussion
aredev
Jun 04, 2018Copper Contributor
Remove File Extension in Custom Header in an Excel Sheet
When I insert file name as using &[File] in the custom header, the file extension ".xlsx " also gets added & printed. How can I display & print an Excel sheet without file extension?
Jun 05, 2018
Hello,
what you describe can only be done with VBA. You need to add this code to the ThisWorkbook module:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.CenterHeader = UCase(Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 5))
End Sub