LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Adding file name and path to to footer of all workbooks in a folder.

Look here

http://www.j-walk.com/ss/excel/tips/tip22.htm

You can run this macro to change all files in the folder C:\Data

Sub test()
Dim mybook As Workbook
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "C:\Data"
ChDrive MyPath
ChDir MyPath
FNames = Dir("*.xls")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If
Application.ScreenUpdating = False
Set basebook = ThisWorkbook
Do While FNames < ""
Set mybook = Workbooks.Open(FNames)

For Each sht In mybook.Sheets
sht.PageSetup.LeftFooter = mybook.FullName
Next sht

mybook.Close True
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub





--
Regards Ron de Bruin
http://www.rondebruin.nl


"Muxer" wrote in message news:Wkodc.225070$Cb.2000687@attbi_s51...
Hello,

Can anyone show me some examples of how to add the file name and path of
workbook to the footer. I would like to do this to all *.xls files in a
folder.

Since at times there is going to be hundreds of files, is it fastest
and/or easier to do this via an add-in, macro or from VB6?

Regards,
LRR



 
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
How to extract only file name from folder path string in Excel? JayKay Excel Worksheet Functions 1 March 20th 09 04:57 PM
How to print file path in footer as default option for all files? Loisita Excel Worksheet Functions 2 September 19th 08 07:45 PM
Launching an XL file gives errors for each folder in path, then opens PCLIVE Excel Discussion (Misc queries) 2 December 26th 07 09:11 PM
Path and File Name to Footer Jeanne Excel Discussion (Misc queries) 3 July 13th 05 01:48 PM
print file path and location in a footer be New Users to Excel 2 June 15th 05 03:56 PM


All times are GMT +1. The time now is 10:37 PM.

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

About Us

"It's about Microsoft Excel"