S
SN
I was hopeing someone could perhaps assist i am currently trying to create
some comboboxes on various userform within Word but really not happening.
A brief descripton
The document is an application form
On which candidates will fill in the relevant fields. (I created a table
within word allowing users to tab threw the necessary fields)
I would like the users to select from a dropdown their nationality, but
can't use the normal word drop down field due to a 25 list limit it has.
So I created a Useform as you mentioned you did in Excell
What I did was as a candidate tabs/click on my bookmark Nationality,
the following module runs
(Module – Nationality)
*********************
Sub gocombobox()
UserForm.Show
End Sub
************************
This then opens my user from called nationality in which there is one
combobox with the following code in it.
***************
Private Sub CmbNationality_Change()
ActiveDocument.FormFields("PresentNationality").Result =
CboNationality.Value
End Sub
____________________________
Private Sub UserForm_Initialize()
CboNationality.ColumnCount = 1
CboNationality.List() = Array("Afghan", "Ukrainian")
End Sub
____________________________
Private Sub Cmdclose_Click()
Unload Me
End Sub
And the above listed cmd to close my userform.
_________________________
This works perfectly no problems at all Fills in the field in Word everyone
is happy.
But then
I then need the candidates to select from a list of 20 dropdown fields (all
of these dropdown fields consist of the exact same data.)Their skills. (due
to the nature of the applicants we work with it is all just short
Abbreviations and Necessary) due to the fact that there are more than 25 to
chose from had to create another userform, Which again upon tabbing to the
first fields of my skill area that the userform SkillsForm will open via
the following module
**************
Option Explicit
Sub gocombobox()
SkillsForm.Show
End Sub
*******************
Then Code in first Combobox Skill 1
Private Sub SkillsForm_Initialize()
Dim var
Dim myArray()
myArray.List() = Array("Eod", "Eod2", "etc", "etc1")
For var = 0 To UBound(myArray)
CboSkills1.AddItem myArray(var)
Next
CboSkills1.ListIndex = 0
End Sub
Private Sub CboSkill1_Change()
ActiveDocument.FormFields("skill1").Result = CboSkills1.Value
End Sub
Private Sub cmdCloseSF_Click()
Unload Me
End Sub
I then on the userform want to create 20 Comboboxes. Which in return should
update the relevant fields on my word document. Again just selecting data to
update the Bookmark Called Skill1 to 20 (If they have that many)
And this is where i am stuck and getting no data at all in the comboboxes.
I am using one combobox for one "bookmark". 1 - 20. (Due to a candidate
maybe having 15 different skills listed in my dropdown)
My problem. I am getting no data within my comboboxes on my second user
form at all. (Skills) (Is there something that i maybe listed in my first
userform (the Nationality one.) that allows that to be the only one working,
Am I approaching this completely wrong, And is there an easier way for me to
list all the combobox values than listing then all 1 by as the above listed
code.
Thanks in advance
some comboboxes on various userform within Word but really not happening.
A brief descripton
The document is an application form
On which candidates will fill in the relevant fields. (I created a table
within word allowing users to tab threw the necessary fields)
I would like the users to select from a dropdown their nationality, but
can't use the normal word drop down field due to a 25 list limit it has.
So I created a Useform as you mentioned you did in Excell
What I did was as a candidate tabs/click on my bookmark Nationality,
the following module runs
(Module – Nationality)
*********************
Sub gocombobox()
UserForm.Show
End Sub
************************
This then opens my user from called nationality in which there is one
combobox with the following code in it.
***************
Private Sub CmbNationality_Change()
ActiveDocument.FormFields("PresentNationality").Result =
CboNationality.Value
End Sub
____________________________
Private Sub UserForm_Initialize()
CboNationality.ColumnCount = 1
CboNationality.List() = Array("Afghan", "Ukrainian")
End Sub
____________________________
Private Sub Cmdclose_Click()
Unload Me
End Sub
And the above listed cmd to close my userform.
_________________________
This works perfectly no problems at all Fills in the field in Word everyone
is happy.
But then
I then need the candidates to select from a list of 20 dropdown fields (all
of these dropdown fields consist of the exact same data.)Their skills. (due
to the nature of the applicants we work with it is all just short
Abbreviations and Necessary) due to the fact that there are more than 25 to
chose from had to create another userform, Which again upon tabbing to the
first fields of my skill area that the userform SkillsForm will open via
the following module
**************
Option Explicit
Sub gocombobox()
SkillsForm.Show
End Sub
*******************
Then Code in first Combobox Skill 1
Private Sub SkillsForm_Initialize()
Dim var
Dim myArray()
myArray.List() = Array("Eod", "Eod2", "etc", "etc1")
For var = 0 To UBound(myArray)
CboSkills1.AddItem myArray(var)
Next
CboSkills1.ListIndex = 0
End Sub
Private Sub CboSkill1_Change()
ActiveDocument.FormFields("skill1").Result = CboSkills1.Value
End Sub
Private Sub cmdCloseSF_Click()
Unload Me
End Sub
I then on the userform want to create 20 Comboboxes. Which in return should
update the relevant fields on my word document. Again just selecting data to
update the Bookmark Called Skill1 to 20 (If they have that many)
And this is where i am stuck and getting no data at all in the comboboxes.
I am using one combobox for one "bookmark". 1 - 20. (Due to a candidate
maybe having 15 different skills listed in my dropdown)
My problem. I am getting no data within my comboboxes on my second user
form at all. (Skills) (Is there something that i maybe listed in my first
userform (the Nationality one.) that allows that to be the only one working,
Am I approaching this completely wrong, And is there an easier way for me to
list all the combobox values than listing then all 1 by as the above listed
code.
Thanks in advance