Insert file name in header without showing extension


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?
 
Ad

Advertisements

×

מיכ×ל (מיקי) ×בידן

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top