Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header/Footer jackiemac1595 Excel Discussion (Misc queries) 5 July 29th 08 05:24 PM
How to insert page numbers in a file, not the header or footer Jay Meza Excel Discussion (Misc queries) 1 June 1st 07 03:17 PM
Header and Footer Need Help Excel Worksheet Functions 1 July 7th 06 02:01 AM
How do i import header and footer from diferent XLS file? Beck New Users to Excel 1 June 26th 06 08:18 PM
Header & Footer RAJEEV CHADHA Excel Worksheet Functions 1 April 13th 05 09:39 AM


All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"