Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Thomas Mallié Thomas Mallié is offline
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Thomas Mallié Thomas Mallié is offline
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
combo box populate MEME Microsoft Word Help 5 May 19th 08 07:07 AM
Have a Combo Box list populate external data jlawson Microsoft Word Help 6 January 19th 07 08:12 PM
Word 2007 - styles combo-box add-in (Office 2007 COM Add-In UI customization example) Patrick Schmid Microsoft Word Help 9 August 31st 06 11:03 AM
Populate Combo Box from csv file planters Microsoft Word Help 1 January 12th 06 09:29 AM
Create Protected Word template that uses combo box & combo box val Cindy Microsoft Word Help 1 April 1st 05 05:10 PM


All times are GMT +1. The time now is 06:31 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"