Multiple UserForms in a Word Document 
Author Message
 Multiple UserForms in a Word Document

I am creating a form in Word Using tables, drop-down
boxes, text fields and now, list boxes.

I have approximately 5 fields in my form that I need to
create a drop-down list for because they have >25 choices
(a limit on the canned drop-down box on the forms toolbar).

I had trouble creating my first ListBox, but someone
helped me out and I changed the details to fit my
application and it works just fine.

Now, I'm ready to create another ListBox in the same
document but I can't get it to populate the box with the
choices I entered.

I'm confused.  Should I create a unique UserForm (and
subsequent Macro) for each ListBox I need?  If so, how do
I get the list to populate in the box?  Do I need to use a
Hide or Show or Unload command?

I don't have any VBA experience. I'm trying to wade
through this on my own, so I would really appreciate any
help or direction someone can provide.

Thanks,

Joan



Sat, 04 Jun 2005 06:59:23 GMT  
 Multiple UserForms in a Word Document
Hi Joan
You can have as many list / combo boxes as you want on a
user form.
Have you given the second one a different name?

How are you filling the box - using Additem or creating an
array.  An array is easiest if you have more than one
column in your box.

Have you looked at the MVP site?  A great place to get
started.  Here is the link
http://www.mvps.org/word/FAQs/index.html
and go to User Forms tab

Good luck.  Keep trying - it is possible!
Regards
Stephen

Quote:
>-----Original Message-----
>I am creating a form in Word Using tables, drop-down
>boxes, text fields and now, list boxes.

>I have approximately 5 fields in my form that I need to
>create a drop-down list for because they have >25 choices
>(a limit on the canned drop-down box on the forms toolbar).

>I had trouble creating my first ListBox, but someone
>helped me out and I changed the details to fit my
>application and it works just fine.

>Now, I'm ready to create another ListBox in the same
>document but I can't get it to populate the box with the
>choices I entered.

>I'm confused.  Should I create a unique UserForm (and
>subsequent Macro) for each ListBox I need?  If so, how do
>I get the list to populate in the box?  Do I need to use a
>Hide or Show or Unload command?

>I don't have any VBA experience. I'm trying to wade
>through this on my own, so I would really appreciate any
>help or direction someone can provide.

>Thanks,

>Joan
>.



Sat, 04 Jun 2005 17:57:46 GMT  
 Multiple UserForms in a Word Document
Stephen,

That is good news, but I am at a loss as to how to make it
happen.

Do I give the UserForm a different name?  I'm thinking I do
because that is the default as I add new UserForms.  Do I
give the ListBox a different name?  I tried that and it
does some strange things on the initialization statement.

I did go out to the MVP website and tried to do some
searches and that is what prompted me to post my question.  
There are so many interesting discussions out there  and
some look like they might be close to my issue, but they
seem to have some unique twist that does not apply to me.

As for how I am populating the list, I am using an array.  
I had gotten a copy of a knowledge base article that walked
me through that much.

Here is the code that I put together for the second
ListBox (it is essentially a copy of the code from the
first ListBox in my document):

Private Sub CommandClose1_Click()

    End

End Sub

Private Sub ListBox1_Change()

    ActiveDocument.FormFields("Text112").Result =
ListBox1.Value

End Sub

Private Sub UserForm1_Initialize()

Dim MyArray(2)

    ListBox1.ColumnCount = 1

    'Load MyArray.
    MyArray(0) = "Test Data 1"
    MyArray(1) = "Test Data 2"
    MyArray(2) = "Test Data 3"

    'Load data into ListBox.
    ListBox1.List() = MyArray

End Sub

I can get the box to pop up as it should.  I can get the
close button to work as it should.  I just can't get the
box to populate with my array.  That is why I think that
I'm missing something that tells Word that this box is
something new.

Joan

Quote:
>-----Original Message-----
>Hi Joan
>You can have as many list / combo boxes as you want on a
>user form.
>Have you given the second one a different name?

>How are you filling the box - using Additem or creating an
>array.  An array is easiest if you have more than one
>column in your box.

>Have you looked at the MVP site?  A great place to get
>started.  Here is the link
>http://www.mvps.org/word/FAQs/index.html
>and go to User Forms tab

>Good luck.  Keep trying - it is possible!
>Regards
>Stephen
>>-----Original Message-----
>>I am creating a form in Word Using tables, drop-down
>>boxes, text fields and now, list boxes.

>>I have approximately 5 fields in my form that I need to
>>create a drop-down list for because they have >25 choices
>>(a limit on the canned drop-down box on the forms
toolbar).

>>I had trouble creating my first ListBox, but someone
>>helped me out and I changed the details to fit my
>>application and it works just fine.

>>Now, I'm ready to create another ListBox in the same
>>document but I can't get it to populate the box with the
>>choices I entered.

>>I'm confused.  Should I create a unique UserForm (and
>>subsequent Macro) for each ListBox I need?  If so, how do
>>I get the list to populate in the box?  Do I need to use
a
>>Hide or Show or Unload command?

>>I don't have any VBA experience. I'm trying to wade
>>through this on my own, so I would really appreciate any
>>help or direction someone can provide.

>>Thanks,

>>Joan
>>.

>.



Sun, 05 Jun 2005 00:22:43 GMT  
 Multiple UserForms in a Word Document
Just wanted to post the fact that I figured a work-around.

I was trying to create a unique UserForm and associated
ListBox for each field that I needed to populate from a
dropdown menu.

I ended up creating five ListBoxes in one UserForm which
then allows me to populate all 5 fields at once.

Thanks for getting me started.

Joan

Quote:
>-----Original Message-----
>Hi Joan
>You can have as many list / combo boxes as you want on a
>user form.
>Have you given the second one a different name?

>How are you filling the box - using Additem or creating an
>array.  An array is easiest if you have more than one
>column in your box.

>Have you looked at the MVP site?  A great place to get
>started.  Here is the link
>http://www.mvps.org/word/FAQs/index.html
>and go to User Forms tab

>Good luck.  Keep trying - it is possible!
>Regards
>Stephen
>>-----Original Message-----
>>I am creating a form in Word Using tables, drop-down
>>boxes, text fields and now, list boxes.

>>I have approximately 5 fields in my form that I need to
>>create a drop-down list for because they have >25 choices
>>(a limit on the canned drop-down box on the forms
toolbar).

>>I had trouble creating my first ListBox, but someone
>>helped me out and I changed the details to fit my
>>application and it works just fine.

>>Now, I'm ready to create another ListBox in the same
>>document but I can't get it to populate the box with the
>>choices I entered.

>>I'm confused.  Should I create a unique UserForm (and
>>subsequent Macro) for each ListBox I need?  If so, how do
>>I get the list to populate in the box?  Do I need to use
a
>>Hide or Show or Unload command?

>>I don't have any VBA experience. I'm trying to wade
>>through this on my own, so I would really appreciate any
>>help or direction someone can provide.

>>Thanks,

>>Joan
>>.

>.



Sun, 05 Jun 2005 06:36:40 GMT  
 Multiple UserForms in a Word Document
Joan

It would help your code if you gave the objects better names.  In six
months time will you be able to know what Text112 is about or
ListBox1?

When you start to build your forms it would make your coding a hundred
times easier if the CommandButton1 were called cmdOK or something like
like and your Text112 called txtShoeSize so that you know what is
going on.

Malc
  www.dragondrop.com



Sun, 05 Jun 2005 22:30:14 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. UserForms values and multiple document fields

2. UserForms and moltiple documents in Word 2000

3. Print a word document built from multiple sub documents using the RD tag

4. Passing Userforms to subs (Word 2000 and 2002, I did not try Word 97)

5. print multiple word documents using a macro

6. multiple images insertion in word document

7. Printing Multiple Documents in Word

8. Handling/merging multiple documents in Word 97

9. Multiple tables in a word document.

10. Multiple tables in a word document

11. Doing an edit replace on multiple word documents

12. Macro enabling us to insert multiple files into a single word document

 

 
Powered by phpBB® Forum Software