Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do content control fields work?
I appreciate the add-in and look forward to trying it out on my next template
project! -- Thanks, Pamela Denchfield "Greg Maxey" wrote: On Dec 18, 4:56 pm, Pamela Denchfield wrote: Is there a way to incorporate the auto-updated content controls without resorting to VBA or other coding? The templates freely downloaded from Office Online seem to have these already incorporated, dependent on standard document properties. It would be nice if I could create these myself, too. -- Thanks, Pamela Denchfield "Greg Maxey" wrote: Here is one way and I am working on others to update my website: Use the Document_ContentConrolOnExit event to write the text value of the current Content Control to a custom document property. Then use DocProperty fields at the other location in your document to repeat the data: Private Sub Document_ContentControlOnExit(ByVal currentCC As ContentControl, Cancel As Boolean) Dim oDoc As Word.Document Set oDoc = ActiveDocument Select Case currentCC.Title Case "Client_Name" On Error Resume Next oDoc.CustomDocumentProperties("Client_Name").Value = currentCC.Range.Text If Err.Number = 5 Then oDoc.CustomDocumentProperties.Add _ Name:="Client_Name", LinkToContent:=False, Value:=currentCC.Range.Text, _ Type:=msoPropertyTypeString End If On Error GoTo 0 Case Else 'Do nothing End Select UpdateDocumentFields End Sub Sub UpdateDocumentFields() Dim pRange As Word.Range Dim iLink As Long iLink = ActiveDocument.Sections(1).Headers(1).Range.StoryT ype For Each pRange In ActiveDocument.StoryRanges Do pRange.Fields.Update Set pRange = pRange.NextStoryRange Loop Until pRange Is Nothing Next End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. piersonal wrote: The sites make really good reading thank you. The one main question that I had was with how to reference a Content Control. A template that I downloaded had a Content Control for the Title, which was repeated on the next page. Update one and the other would update. This is good for existing Property fields, but can we create custom ones? I want to have users enter the customer name on the front page (into a Content Control) and to have this information repeated in other areas, but I cannot for the life of me figure out how to do this.- Hide quoted text - - Show quoted text - Pamela, I experimented today with creating and AddIn that would allow a user to insert multiple custom mapped CCs seemingly effortless and without needing to do any VBA or XML coding. I want to refine it a bit before I post it to my website but if you contact me through the website feedback I will share it with you now. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Content Control Titles Vanishing | Microsoft Word Help | |||
What is a Tag in the Content Control Properties dialog box? | Microsoft Word Help | |||
form content disappears with select-all/update fields | Microsoft Word Help | |||
Control key shortcuts do not work | Microsoft Word Help | |||
How do I make the Table of Content link work? | Microsoft Word Help |