View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Macro for combo/drop down list

This sounds like Greg Maxey's sphere of interest - start at
http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


ah wrote:
Hi;

Need your help urgently.
I'm in the midst of developing a form. Can anyone help me with the
following:

a) I wish to put the following into my form:
- Country
- Personnel Area
- Employee Group
-Employee Subgroup and etc

FYI, the above needs to have 25 selection list.
I wish to have different personnel area, employee group and employee
subgroup selection list when I select different country.Thus, it is
going to have different personnel area associated with the country
that I select.

b) I tried to do the macro just now. However, I only managed to get
the drop down list mapped to the country field. By right, I need to
use a combo box in stead of a drop down list for personnel area,
employee group and employee subgroup, right?

c) Since there are so many fields in the form, does it mean that I
need to create multiple form in the Microsoft Visual Basic. I tried
to map the country with the personnel area list just now. Since there
are 2 fields involved, I've created 2 forms. Please advice whether I
am doing the correct things.

Below is the macro that I've put into the form. Appreciate if you
could guide me on this:

Form 1:
--------
Private Sub ComboBox1_Change()

ActiveDocument.FormFields("Country").Result = ComboBox1.Value

End Sub

----------------------------------------------------------------------

Private Sub UserForm_Initialize()

ComboBox1.ColumnCount = 1

'Load data into ComboBox

ComboBox1.List() = Array("AP", "EMEA", "USA")


End Sub
-----------------------------------------------------------


Form 2
--------

Private Sub ComboBox2_Change()

ActiveDocument.FormFields("PersonnelArea").Result = ComboBox2.Value

End Sub

--------------------------------------

Private Sub UserForm_Initialize()

ComboBox2.ColumnCount = 1

'Load data into ComboBox

ComboBox2.List() = Array("BER3 (DE03-Berlin )", "DIE3
(DE03-Dietzenbach )", "DUS5 (DE05-Dusseldorf )", "FLE3
(DE03-Flensburg )")


End Sub

Macro:
-------



Private Sub ComboBox2_Change()

ActiveDocument.FormFields("PersonnelArea").Result = ComboBox2.Value

End Sub



Private Sub UserForm_Initialize()

ComboBox2.ColumnCount = 1

'Load data into ComboBox

ComboBox2.List() = Array("BER3 (DE03-Berlin )", "DIE3
(DE03-Dietzenbach )", "DUS5 (DE05-Dusseldorf )", "FLE3
(DE03-Flensburg )")




End Sub