Apply header to multiple documents

seb -  
 Seb -
Hello,

My problem is as follows: I have about a hundred documents for which I need to change the header and the footer, and I would like to know if there is a method to change just one and then apply the modification to all the other documents.

Thank you in advance to those who take the time to respond to me.

Sincerely,

Configuration: Windows XP / Internet Explorer 8.0

3 answers

  1. commentcamarcheeay Posted messages 735 Status Member 86
     
    Hello,

    I imagine that macros can indeed do this kind of thing,
    Here is an example:
    Sub Macro1() ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader Selection.TypeText Text:="Hello World" ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End Sub

    What I suggest you do (I'm talking about the Word 2000 version), is
    - go to Tools > Macro > New_macro... (this allows you to record everything you do with the mouse, thus avoiding unnecessary clicks.
    - edit the header of your text.
    - once the editing is complete, save the macro in a file from the VBA environment: Tools > Macro > Visual_Basic_Editor

    I agree that it's not easy if you've never worked with VBA before, but it's very simple once you manage to record the macro and use it for other documents.

    To finish what I was saying, the recorded macro is classified in the VBA environment under the Modules. You will find a few lines that look like what I wrote above.

    Now all you have to do is open your files and apply this macro to each one. To do this, go to Tools > Macro > Macro... In the window that opens, select the name of the macro and Run. If your documents do not contain any other macros, the macro you just created will default to the name Macro 1.

    There you go, I hope this can help you,
    Best regards,

    --
    C. Taha
    0
  2. m@rina Posted messages 27623 Registration date   Status Moderator Last intervention   11 564
     
    Hello,

    You indeed need to use macros... but don't mess around trying to run the macro manually on all hundred files.

    Start by creating your macro for a single file, drawing inspiration from the code provided by commentcamarcheeay, and once you're confident (check on several files), you can use the batch macro that I posted here:
    https://faqword.com/index.php/ressources/downloads/viewdownload/10-utilitaires-maison/130-batchmacro

    One thing: if your header is complicated (table, logo, etc.), make it an auto-insertion and use the macro to insert the auto-insertion into your header.

    m@rina

    If you want to be helped effectively, make sure you’re on the right forum,... and specify the software you’re using and its version. We lack clairvoyants!
    0
  3. Seb
     
    Hello and thank you for your responses,

    The problem is that these Word documents are edited from a hotel booking software, I contacted their technical support, and using macros could cause issues...

    So I have to resort (apparently) to the exciting method of changing my headers one by one.......

    Finally, I will look into VBA, I will always learn useful things for the future!

    Best regards,

    seb
    0