Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How can I use a combo box to populate text field in Word 2007?
Hi all,
I'm busy creating a Word 2007 template for a technical procedure for my company. On the first page, I've inserted a combo box with the four confidentiality values in use for our procedures (Highly confidential, Confidential, Restricted and Public). I'd like the value chosen in this combo box to be repeated in the header of the following section. But I do not find a way to link a field in the header to the combo box on the first page and auto update when a value is chosen in that combo box. Is this possible? Tx in advance |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How can I use a combo box to populate text field in Word 2007?
Perhaps you could put a bookmark in the following section header e.g.,
Sect2Class and then use the ComboBox change event: Private Sub ComboBox1_Change() Dim oRng As Word.Range Set oRng = ActiveDocument.Bookmarks("Sect2Class").Range oRng.Text = Me.ComboBox1.Value ActiveDocument.Bookmarks.Add "Sect2Class", oRng End Sub Thomas Mallié wrote: Hi all, I'm busy creating a Word 2007 template for a technical procedure for my company. On the first page, I've inserted a combo box with the four confidentiality values in use for our procedures (Highly confidential, Confidential, Restricted and Public). I'd like the value chosen in this combo box to be repeated in the header of the following section. But I do not find a way to link a field in the header to the combo box on the first page and auto update when a value is chosen in that combo box. Is this possible? Tx in advance -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org McCain/Palin '08 !!! |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How can I use a combo box to populate text field in Word 2007?
Hi Greg,
thanks for your answer, but could you detail where I have to put that code? I don't know how it works with Word 2007. cheers "Greg Maxey" wrote: Perhaps you could put a bookmark in the following section header e.g., Sect2Class and then use the ComboBox change event: Private Sub ComboBox1_Change() Dim oRng As Word.Range Set oRng = ActiveDocument.Bookmarks("Sect2Class").Range oRng.Text = Me.ComboBox1.Value ActiveDocument.Bookmarks.Add "Sect2Class", oRng End Sub Thomas Mallié wrote: Hi all, I'm busy creating a Word 2007 template for a technical procedure for my company. On the first page, I've inserted a combo box with the four confidentiality values in use for our procedures (Highly confidential, Confidential, Restricted and Public). I'd like the value chosen in this combo box to be repeated in the header of the following section. But I do not find a way to link a field in the header to the combo box on the first page and auto update when a value is chosen in that combo box. Is this possible? Tx in advance -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org McCain/Palin '08 !!! |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How can I use a combo box to populate text field in Word 2007?
For the creation of Word forms, the new content controls in Word 2007, in my
opinion, leave a lot to be desired. Personally I would use the legacy form fields and create a dropdown box for your entries and use a REF field to reproduce the content. REF fields in page headers do not update automatically, but you can use the update macro at http://www.gmayor.com/installing_macro.htm to force an update run on exit from the dropdown field. If you decide to follow this route, Greg has an add-in that makes the use of legacy form fields much more accessible in Word 2007 - http://gregmaxey.mvps.org/Classic%20Form%20Controls.htm and has more information on repeating text - http://gregmaxey.mvps.org/Repeating_Data.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Thomas Mallié wrote: Hi Greg, thanks for your answer, but could you detail where I have to put that code? I don't know how it works with Word 2007. cheers "Greg Maxey" wrote: Perhaps you could put a bookmark in the following section header e.g., Sect2Class and then use the ComboBox change event: Private Sub ComboBox1_Change() Dim oRng As Word.Range Set oRng = ActiveDocument.Bookmarks("Sect2Class").Range oRng.Text = Me.ComboBox1.Value ActiveDocument.Bookmarks.Add "Sect2Class", oRng End Sub Thomas Mallié wrote: Hi all, I'm busy creating a Word 2007 template for a technical procedure for my company. On the first page, I've inserted a combo box with the four confidentiality values in use for our procedures (Highly confidential, Confidential, Restricted and Public). I'd like the value chosen in this combo box to be repeated in the header of the following section. But I do not find a way to link a field in the header to the combo box on the first page and auto update when a value is chosen in that combo box. Is this possible? Tx in advance -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org McCain/Palin '08 !!! |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How can I use a combo box to populate text field in Word 2007?
Thomas,
By your use of "ComboBox" and no mention of a userform I assumed that you were using an ActiveX combobox in the document. In view of Graham's post and your separate message to me, it appears that you want to use a Dropdown ContentControl. While I am not as put off with CCs as my old pal Graham, they do have their quirks but in this case I think the following code (in the ThisDocument module) will work: Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean) Dim oRng As Word.Range Select Case CC.Title Case Is = "DocStatus" 'the title of your CC Dropdown. If CC.Range.Text "Choose an item." Then Set oRng = ActiveDocument.Bookmarks("Sect2Header").Range 'You need to put a bookmark in the section 2 header named "Sect2Header" oRng.Text = CC.Range.Text ActiveDocument.Bookmarks.Add "Sect2Header", oRng Else Set oRng = ActiveDocument.Bookmarks("Sect2Header").Range oRng.Text = "" ActiveDocument.Bookmarks.Add "Sect2Header", oRng End If Case Else 'Do nothing End Select End Sub -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org McCain/Palin '08 !!! "Thomas Mallié" wrote in message ... Hi Greg, thanks for your answer, but could you detail where I have to put that code? I don't know how it works with Word 2007. cheers "Greg Maxey" wrote: Perhaps you could put a bookmark in the following section header e.g., Sect2Class and then use the ComboBox change event: Private Sub ComboBox1_Change() Dim oRng As Word.Range Set oRng = ActiveDocument.Bookmarks("Sect2Class").Range oRng.Text = Me.ComboBox1.Value ActiveDocument.Bookmarks.Add "Sect2Class", oRng End Sub Thomas Mallié wrote: Hi all, I'm busy creating a Word 2007 template for a technical procedure for my company. On the first page, I've inserted a combo box with the four confidentiality values in use for our procedures (Highly confidential, Confidential, Restricted and Public). I'd like the value chosen in this combo box to be repeated in the header of the following section. But I do not find a way to link a field in the header to the combo box on the first page and auto update when a value is chosen in that combo box. Is this possible? Tx in advance -- Greg Maxey - Word MVP My web site http://gregmaxey.mvps.org Word MVP web site http://word.mvps.org McCain/Palin '08 !!! |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
combo box populate | Microsoft Word Help | |||
Have a Combo Box list populate external data | Microsoft Word Help | |||
Word 2007 - styles combo-box add-in (Office 2007 COM Add-In UI customization example) | Microsoft Word Help | |||
Populate Combo Box from csv file | Microsoft Word Help | |||
Create Protected Word template that uses combo box & combo box val | Microsoft Word Help |