#1
|
|||
|
|||
change every footer in a folder of workbooks
Hello,
I'm a vba newb who knows just enough to be dangerous lol but i have like 2800 workbooks I need to change the right footer in to match a new form number. i keep finding stuff for word docs and don't know the code well enough to even record my own macro. Please help!! |
#2
|
||||
|
||||
At the bottom of this page there are several "Similar Threads" and most are 'Solved'. See if you can adapt one of those solutions for your needs.
__________________
Difficult is not to know but to share what you know (Han Fei Tzu reworked) |
#3
|
|||
|
|||
re rollis13
yeah, but they are all for word and i'm not smart enough to adapt them to excel. or I haven't learned how yet..
|
#4
|
||||
|
||||
Oh, so you need a ready-made macro ... a forum is not the place for this .
Anyway, are the files all in one folder or even in subfolders ? so the path can be hard-coded in the macro. Do the files contain a single sheet that has the right-footer to be update ? and does this sheet always have the same name ? elsewise you will have to loop through the sheets or skip some. Does the actual right-footer contain a single data (old form number) or is it merged with other data ? Do the files contain autorun macros ?
__________________
Difficult is not to know but to share what you know (Han Fei Tzu reworked) Last edited by rollis13; 01-16-2024 at 10:34 AM. |
#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) |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Batch change the footer in multiple files with footer from another file | kalagas | Word VBA | 9 | 02-10-2020 12:40 AM |
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 |
Find & replace footer text in a folder of Word 2010 documents | kennethc | Word | 3 | 03-28-2015 02:49 AM |
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 |