If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
File name in the footer/header
Is there a way to insert the file name in a footer/header without the ".xls"
in the name? Basharat. |
#2
|
|||
|
|||
File name in the footer/header
Put the following in the Workbook event mcro area:
Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.CenterHeader = ActiveWorkbook.Name End Sub -- Gary''s Student - gsnu2007b "Basharat A. Javaid" wrote: Is there a way to insert the file name in a footer/header without the ".xls" in the name? Basharat. |
#3
|
|||
|
|||
File name in the footer/header
And to remove the last 4 characters of the .name:
Private Sub Workbook_BeforePrint(Cancel As Boolean) dim myName as string myName = me.name worksheets("Somesheetnamehere").PageSetup.CenterHe ader _ = right(myname,len(myname)-4) End Sub I used the Me keyword--it refers to the object that owns the code. In this case, it's the workbook that's being printed. And I only changed a specific worksheet--not the activesheet. Gary''s Student wrote: Put the following in the Workbook event mcro area: Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.CenterHeader = ActiveWorkbook.Name End Sub -- Gary''s Student - gsnu2007b "Basharat A. Javaid" wrote: Is there a way to insert the file name in a footer/header without the ".xls" in the name? Basharat. -- Dave Peterson |
Thread Tools | |
Display Modes | |
|
|