• WD97 – more than 25 items in a dropdown list

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » WD97 – more than 25 items in a dropdown list

    Author
    Topic
    #352358

    Is it posible to have more than 25 items in a Word Dropdown list field?

    Viewing 0 reply threads
    Author
    Replies
    • #512222

      No- not as far as I know.

      What you can do instead is to have a text form field with a macro on exit- that macro displays a userform with all of your choices. It’s probably nicer anyway- you have to scroll down a large dropdown box; on a userform you can show things very nicely, and make it look very professional. It can impress the heck out of your users!

      • #512223

        Could you explane how I must do that?

        • #512265

          I can’t explain and expect that Geoff can.

          (A couple of bars from “The Twilight Zone” theme here.) You are about to enter a world of untold power over Microsoft Word – the world of the UserForm and VBA!

          You may want to download the following and take a look at them.
          http://www.addbalance.com/word/download/AskForm.zip%5B/url%5D and
          http://www.addbalance.com/word/download/UserForm.zip%5B/url%5D.
          (These are both designed as tutorials with the VBA unlocked.)

          http://www.mvps.org/word/FAQs/Userforms/CreateAUserForm.htm%5B/url%5D
          http://www.mvps.org/word/FAQs/index5.html%5B/url%5D VBA FAQ
          http://www.mvps.org/word/FAQs/index10.html%5B/url%5D UserForms FAQ

          Hope this helps,

          • #512488

            Thanks,
            I will have a look, and let you know if it worked.

        • #512327

          Patrick,

          I’m not sure whether it’s the Userform you need help with or attaching a macro. I’ll attack the second, come back if you need help with the first:

          .Write your macro – eg:
          sub showForm
          myForm.show
          End Sub

          .Insert your text form field
          .Double click on it
          .Click on the “Run macro on exit” down arrow. “showForm” will be on the list. Select it.
          .Protect the document

          • #512854

            Thank you all.
            I now see the problem clearly and understand that using UserForms is much more flexible than the word form options.

            • #513241

              After solving some problems for the user he send me the document and then I saw al the calculations and so on. So To make it al easier I recommended the user to create a Excel template instead of a word template.

            • #513343

              Hi,

              That’s often the case- and it happend quite a lot in this forum.

              A problem is posted, and people attempt to solve it. But in many cases, people who try rto solve the problem can’t see the whole picture. So in your case, when you see the broader picture, it becomes obvious that your original problem was not the right problem. Congratulations on being able to broaden your solution further.

              In the meantime, solutions have become a part of a knowledge database. If solutions posted did not suit you this time, they may well help somebody else in a different circumstance.

      • #513068

        Hi Geoff:

        Could you explain what you mean by a userform (as opposed to a form field) & how you’d display more than 25 lines?

        Thanks,

        • #513085

          Phil,

          I’va attached a VERY rough sample of what I mean.

          The module whiich displays the userform is initiated by the “OnExit” macro from form field “Text2”

          • #513087

            Hi,

            Another strategy worth mentioning, when you need to display a really long list in a listbox on a userform, is to break the list into more than one piece, and provide option buttons that permit the user to indicate which part of the list they want to see.

          • #513115

            Thanks, Geoff. Another area I need to learn about. It seemed to me that there was no On Exit macro. The code that you used showed the userform upon entry into the Text2 bookmark and did so behind the scenes…i.e. nothing was checked in the property box of any of the form fields.

            • #513136

              Phil,

              There’s no On Exit- the form processing populated Text2 from within the form, and then gave focus to Text3.

              There is an “On Entry” macro on Text2. Double clicking on Text2 (while the form is unprotected) *should* show the macro name in the “Macro on Entry” box.

              Using userforms in this way can add all sorts of flexibility to a form, and allow things to be done which would be much more awkward or complicated than just using form fields.

            • #513150

              Hi Geoff:

              Thanks for the explanation. I would have expected an OnEntry macro as the userform pops up as soon as you enter the field. However, it’s strange. When I look at properties (or double click the field), the “Run macro on” entry or exit is blank. Yet if I scroll in the “Entry” field & put a blank there & click OK, the userform is then disabled. What macro should be listed in the “Entry” box? Is it listed when you look at the Text2 properties?

            • #513160

              Phil,

              It’s strange- I can see “main” listed on the “Run macro on entry” (and I’m on a different computer than before.

              It may be that you have another “main” available somewhere- and that I should have used a more unique name? And that when you click on Text2, it can’t resolve which one?

              I’ve noticed before that at times when it doesn’t whow something there, it seems to still keep the value. If I have a routine in “On Entry”, then delete the macro to which it refers, it shows as blank; however, if I add the macro in again, the name reappears.

            • #513176

              Hi Geoff:

              That might be it–I have an AutoExec.Main & AutoOpen.Main that was put there by an add-in (it’s a bookmark toolbutton by Prime Consulting). I can’t view the code, of course, but you think that would cause it? What I’ll do is experiment by renaming the Main macro to almost anything else & then put that as an OnEntry macro for text2. Anyway, it’s very interesting. Someday, when I get off these boards for awhile, I’ll have to read a VBA book.

    Viewing 0 reply threads
    Reply To: WD97 – more than 25 items in a dropdown list

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: