![]() |
|
#1
|
||||
|
||||
![]() Quote:
The code for adding the DOCVARIABLE field to the header of existing documents varies depending on whether those documents already have header content and what you want to do with whatever's already there. Assuming they don't have any header content that you want to keep, the code for replicating the newly-attached template's header DOCVARIABLE field is as simple as: Code:
Sub AddDocVarFld() ActiveDocument.Sections.First.Headers(wdHeaderFooterPrimary).Range.FormattedText = _ ThisDocument.Sections.First.Headers(wdHeaderFooterPrimary).Range.FormattedText End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Thanks. The header has the company logo, title etc. The word document is a sheet that gets filled in by hand. The serial number section goes on a specific top right hand corner because the sheet gets scanned for archiving. The scanner 'looks' for the specific section to automatically assign and save a file name for that document. We currently have a box to where the user has to affix a serialized label. They too have to be careful to affix it within the printed square and perfectly align otherwise the scanner will not 'read' the barcode. Hence trying to automate this will save at least 30min work per employee per job several times per day.
I will give your suggestions a go and post my result or further questions. |
![]() |
Tags |
global, macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Carolin | Word VBA | 3 | 12-14-2014 04:01 AM |
![]() |
New Daddy | Word | 3 | 12-17-2013 07:08 AM |
Using macro to add variable number of rows to a protected word table | Julia | Word Tables | 1 | 01-09-2013 06:04 AM |
![]() |
hanvyj | Excel Programming | 4 | 12-14-2012 03:23 AM |
Merging word files from excel macro | hklein | Excel Programming | 0 | 08-05-2011 02:27 AM |