ComboBox Userform Word AA

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
 
J

John McGhie [MVP Word, Word Mac]

I'm re-directing this post to vba.userforms, where it will come under the
noses of people who do this all day for a living.

We need to attention the serious code warriors to the fact that you are
doing this in Mac Word, where VBA never got above VBA 5 (Word 2000).

Cheers

--

Please reply in the group. Please do NOT email me unless I ask you to.

http://jgmcghie.fastmail.com.au/

John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
S

SN

Thank you very much for the asssistance, I am however using MS Word 2003 on
an XP machine...MMMMMMM

Well i hope someone might be of assistance on this forum
Thanks again..
 
S

SN

Thank you very much

I am however using MS Word 2003 on an XP machine...MMMMM

I Hope someone in this forum might be of assistance

Thanks again
 
D

Doug Robbins - Word MVP

Why not use a userform for the whole thing? See the following series of
articles

Please Fill Out This Form
Part 1: Create professional looking forms in Word
http://www.computorcompanion.com/LPMArticle.asp?ID=22

Part 2: Adding Automation to your Word forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=46

Part 3: Learn more VBA (macros) to automate your forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=119

Part 4: Use custom dialog boxes in your Word forms
http://www.computorcompanion.com/LPMArticle.asp?ID=127

Part 5: Connect your AutoForm to a database to save input time and keep
better records!
http://www.computorcompanion.com/LPMArticle.asp?ID=136




--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

SN

Hi

Thanks for the advise
None of these pages want to open.. MMM
will this not increase the size of my document quite abit, It is already at
489 and scared to increase it even more, since it will be emailed around
allot and then imported into a db.
I have spent quite abit of time on it, this is my last step fixing the
Userform so any help would really be appreciated.
Sn
 
J

Jean-Guy Marcil

SN was telling us:
SN nous racontait que :
Thank you very much for the asssistance, I am however using MS Word
2003 on an XP machine...MMMMMMM

Well i hope someone might be of assistance on this forum
Thanks again..

Why are using two different methods to fill the comboboxes?
For the Nationality one you use:
Private Sub UserForm_Initialize()

CboNationality.ColumnCount = 1

CboNationality.List() = Array("Afghan", "Ukrainian")

End Sub

But for the Skill ones, you use:
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
???

Some problems with this last one:
- In Word VBA, "SkillsForm_Initialize" never works, you must always use
"UserForm_Initialize", regardless of the form name.
- Variables do not have methods or properties, so "myArray.List()" will not
work. But you probably did not notice since the code inside the Initialize
event does not even get compiled because of the error I mentioned above.
- Why use a For Next loop that takes longer than a simple array assignment?

So, first, change all that to
CboSkills1.List() = Array("Eod", "Eod2", "etc", "etc1")

CboSkills1.ListIndex = 0
and then see if the rest of the code works.


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

John McGhie [MVP Word, Word Mac]

And you posted your question in a group dedicated to Word on the Macintosh?
That would be ...mmmmm?

--

Please reply in the group. Please do NOT email me unless I ask you to.

http://jgmcghie.fastmail.com.au/

John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
J

Jim Gordon MVP

Hi John,

Not such a bad thing in this case, as Word for Mac should have the same
behavior as Word for Windows. This discussion might inspire a Mac person or
two to give it a try.

-Jim


in said:
And you posted your question in a group dedicated to Word on the Macintosh?
That would be ...mmmmm?

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info
 
J

John McGhie [MVP Word, Word Mac]

Hi Jim:

Yeah, I know, and I am sure he didn't INTEND to come in here in any case.
We know how the Electronic Headless Chicken sprays stuff around.

I was just slapping him for chiding me for assuming he was on a Mac. It's
not an unreasonable assumption when they come into this group, I would have
thought :)

Cheers

--

Please reply in the group. Please do NOT email me unless I ask you to.

http://jgmcghie.fastmail.com.au/

John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
J

Jim Gordon MVP

Judging from all the Wndows people in here I'd hazard a guess it's not
terribly obvious that they're in a Macintosh portion of the world.

If we're really nice maybe more will switch once they realize we play on
much the same lot.

-Jim


in said:
Hi Jim:

Yeah, I know, and I am sure he didn't INTEND to come in here in any case.
We know how the Electronic Headless Chicken sprays stuff around.

I was just slapping him for chiding me for assuming he was on a Mac. It's
not an unreasonable assumption when they come into this group, I would have
thought :)

Cheers

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top