Insert file name in header without showing extension

  • Thread starter Thread starter Cynergy
  • Start date Start date
C

Cynergy

I know how to get the filename into a header/footer. Is there any way to get
the filename in the header/footer WITHOUT showing the filename extension?
 
1) Click on 'My Computer' > 'Tools' > 'Folder Options...' > View tab and
check the option "Hide extensions for known files".
OR:
2) If you don't want to change the way your computer displays file names -
make use of a Macro:
-------------------------------------------------------
Sub Header_FileName_No_Extension()
On Error Resume Next
LFN = InStrRev(ActiveWorkbook.Name, ".")
FN = Left(ActiveWorkbook.Name, LFN - 1)
ActiveSheet.PageSetup.CenterHeader = FN
End Sub
 
Back
Top