#1
|
|||
|
|||
Running Macro in Multiple word files
Hello Administrator,
I've no knowledge in writing codes or running macro. Therefore, I'm seeking your help (I would really appreciate it). I've like around 300 word files in a specific folder, that I need to add "Confidential - Not for distribution" in a footnote (currently there is nothing in the footer). Can you please help me create the macro for this? I would appreciate if you can use above text in your eg. Once I run the macro, All files will have above note in footer? Thank you for your help and time! |
#2
|
||||
|
||||
You could use http://www.gmayor.com/document_batch_processes.htm to handle the documents and run the following as a custom process:
Code:
Function AddFooter(oDoc As Document) As Boolean On Error GoTo err_Handler Dim oSection As Section Dim oFooter As HeaderFooter For Each oSection In oDoc.Sections For Each oFooter In oSection.Footers If oFooter.Exists Then oFooter.Range.Text = "Confidential - Not for distribution" End If Next oFooter Next oSection AddFooter = True lbl_Exit: Exit Function err_Handler: AddFooter = False Resume lbl_Exit End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
When I run the above the code it says "variable not defined"
|
#4
|
||||
|
||||
Did you run it from the batch processor?
It works fine when run from there. Open a document and run it on that document using the following macro Code:
Sub Macro1() AddFooter ActiveDocument End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Run a macro on multiple docx. files | Peter Carter | Word VBA | 27 | 12-15-2022 04:10 PM |
Macro for multiple RTF files | papapaleo | Word VBA | 1 | 07-28-2017 04:56 AM |
Macro for Combining Multiple Word Files Together Into One Document | rsrasc | Word VBA | 2 | 10-31-2014 07:58 AM |
Word 2010 running multiple instances | JBE | Word | 0 | 09-28-2012 06:00 PM |
looking for macro for multiple files | bolk | Word | 3 | 05-03-2011 05:46 AM |