![]() |
|
#1
|
|||
|
|||
|
I am working on a template for software release documents. The title page will have the version number. We also need to have the version number in the header/footer. Is it possible to create a field on the title page for entry of the version, and have Word then autoinsert that info into the header? Last edited by Charles Kenyon; 06-15-2016 at 02:51 PM. Reason: Mark as solved |
|
#2
|
|||
|
|||
|
No input field needed. Use a StyleRef Field to put your version number in the header/footer. You would want to use a custom character style for your version number.
Other methods:Repeating Data (Populating Multiple Like Fields) |
|
#3
|
|||
|
|||
|
Tangentially related--is there a command to update all fields in a document?
|
|
#4
|
|||
|
|||
|
Not really. The thing is that Word puts things in layers or containers.
See the example given by Graham Mayor here: Installing Macros. I believe that the following is the most thorough macro to do this that I've encountered. It comes from Greg Maxey in this thread. Code:
Sub UpdateAllFieldsAllStoryMaxey() ' Greg Maxey
' http://answers.microsoft.com/en-us/office/forum/office_2007-word/how-to-update-all-fields-in-a-document-at-once/54b43181-0ea7-4abc-bfb9-e0555125dfe5?page=5
Dim rngStory As Word.Range
Dim lngJunk As Long
Dim oShp As Shape
Dim oToc As TableOfContents, oToa As TableOfAuthorities, oTof As TableOfFigures
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
For Each rngStory In ActiveDocument.StoryRanges
'Iterate through all linked stories
Do
On Error Resume Next
rngStory.Fields.Update
Select Case rngStory.StoryType
Case 6, 7, 8, 9, 10, 11
If rngStory.ShapeRange.Count > 0 Then
For Each oShp In rngStory.ShapeRange
If oShp.TextFrame.HasText Then
oShp.TextFrame.TextRange.Fields.Update
End If
Next
End If
Case Else
'Do Nothing
End Select
On Error GoTo 0
'Get next linked story (if any)
Set rngStory = rngStory.NextStoryRange
Loop Until rngStory Is Nothing
'Special Cases
For Each oToc In ActiveDocument.TablesOfContents
oToc.Update
Next oToc
For Each oToa In ActiveDocument.TablesOfAuthorities
oToa.Update
Next
For Each oTof In ActiveDocument.TablesOfFigures
oTof.Update
Next
Next
End Sub
My experience, though, is that StyleRef fields update instantly when in a header or footer. I believe that this is true when they are in the body of a document as well but am not certain. I do know that they update much better than do REF fields. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Creating a Form with Fields that will Populate into Another Document
|
Mobius | Word | 3 | 05-06-2016 12:46 AM |
| Macro to keep formatted form fields after mail merge or replace text with formatted form fields | jer85 | Word VBA | 2 | 04-05-2015 10:00 PM |
Multiple Text Fields in Form
|
robstark | Word | 1 | 08-11-2014 11:26 AM |
| Extract form fields to Word Document | RonNCmale | Word VBA | 22 | 01-11-2014 05:06 AM |
Form Fields - Create blank form text field with if statement?
|
LAssist2011 | Word | 5 | 12-14-2011 03:02 PM |