Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 01-17-2024, 09:58 AM
rollis13's Avatar
rollis13 rollis13 is offline change every footer in a folder of workbooks Windows 11 change every footer in a folder of workbooks Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 143
rollis13 will become famous soon enough
Default

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)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
change every footer in a folder of workbooks Batch change the footer in multiple files with footer from another file 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
change every footer in a folder of workbooks Find & replace footer text in a folder of Word 2010 documents kennethc Word 3 03-28-2015 02:49 AM
change every footer in a folder of workbooks Word Macro - change date in footer for all files in a folder 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:15 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft