![]() |
#5
|
||||
|
||||
![]()
This could be a basic macro that you can upgrade as needed. As it is the folder name is static (no subfolders) and will change the right-foot only on the first sheet of each file.
Code:
Option Explicit Sub UpdateRightFooter() Dim wkb As Workbook Dim sht As Worksheet Dim myPath As String Dim strFile As String Dim cnt As Long Application.ScreenUpdating = False Application.DisplayAlerts = False Application.EnableEvents = False Application.StatusBar = "Macro at work ... please wait" myPath = "F:\Prove\Test\" '<- adjust path as needed strFile = Dir(myPath & "*.xls*") 'for all sort of Excel files Do While Len(strFile) > 0 Workbooks.Open (myPath & strFile) Set wkb = ActiveWorkbook Set sht = wkb.Worksheets(1) 'only for first sheet in file sht.PageSetup.RightFooter = "New Form Number" '<- adjust string as needed cnt = cnt + 1 wkb.Close True strFile = Dir Loop Application.ScreenUpdating = True Application.DisplayAlerts = True Application.EnableEvents = True Application.StatusBar = Empty MsgBox "Done! for " & cnt & " files" End Sub
__________________
Difficult is not to know but to share what you know (Han Fei Tzu reworked) |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
kalagas | Word VBA | 7 | 06-12-2025 03:23 PM |
I have 20 page word document with a footer. Can i change page # 10 footer only? | aligahk06 | Word | 2 | 10-25-2017 04:53 AM |
![]() |
kennethc | Word | 3 | 03-28-2015 02:49 AM |
![]() |
patidallas22 | Word VBA | 2 | 03-09-2012 08:14 AM |
Loop through folder of workbooks and copy range to other workbook | Snvlsfoal | Excel Programming | 3 | 07-29-2011 05:55 AM |