KB 198561-WD2000 Combo Boxes

G

Guest

If I create more than 1 combo box following the above KB
article, the second box will not work.

Can some please look at the 2 codes and tell me what I am
doing wrong?

Thanks

CODE1 - THIS WORKS

___________________________________

Private Sub ComboBox1_Change()

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

End Sub

Private Sub Cmdclose_Click()

Unload Me

End Sub

Private Sub UserForm_Initialize()

ComboBox1.ColumnCount = 1

'Load data into ComboBox

ComboBox1.List() = Array("The defendant is before the
Court for review.", "To inform the Court of the
defendant's violations of probation.", "The defendant is
before the Court for sentencing after revocation.")

End Sub


Sub gocombobox()

frmcombo.Show

End Sub


_________________________________

CODE 2 DOES NOT WORK

Private Sub ComboBox2_Change()

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

End Sub

Private Sub Cmdclose_Click()

Unload Me

End Sub

Private Sub UserForm_Initialize()

ComboBox2.ColumnCount = 1
'Load data into ComboBox
ComboBox2.List() = Array("Review Hearing", "Violation
hearing")

End Sub

Sub gocombobox2()

ReasonHearing.Show

End Sub

The VBA window keeps going back the "ReasonHearing.Show".
Please someone help
 
P

Perry

The 2 pieces of code are technically equal, so comes down to following
questions:

ReasonHearing - is this a userform?
If so, do you have a formfield called "Text2" in your document?
ActiveDocument.FormFields("Text2").Result =
ComboBox2.Value
Is a oneliner, right?
ActiveDocument.FormFields("Text2").Result = ComboBox2.Value

Same goes for
ComboBox2.List() = Array("Review Hearing", "Violation
hearing")
A oneliner too, right/
Array("Review Hearing", "Violation hearing")

Just trying to raise some questions you may have overlooked ...

Apart from these questions, there's nothing wrong with code sequence 2
in yr message.

Krgrds,
Perry
 
G

Guest

1) ReasonHearing is a userform
2) Yes there is form field "Text2" in my document.
3) Yes, is a one liner.
4) Yes to the rest.

Oh I just opened my template up and it works!

They uploaded an update/service pack to Office last
night. I wonder if the lacking service pack was causing
problems for my VBA code?
 
C

Cindy M -WordMVP-

Oh I just opened my template up and it works!
They uploaded an update/service pack to Office last
night. I wonder if the lacking service pack was causing
problems for my VBA code?
Hard to say without knowing all the details about your code
and what it was manipulating in Word. More likely something
got "stuck" in VBA and was "unstuck" by rebooting
Windows...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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