Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-19-2016, 12:43 PM
ajanson ajanson is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2013
Novice
Multiple Selection Dropdown list
 
Join Date: Aug 2016
Posts: 9
ajanson is on a distinguished road
Default Multiple Selection Dropdown list

Hello,



How do i insert a multiple selection dropdown list into my document? I have already inserted the listbox, and changed the multi-select to 2, but i have no idea what code to use. I just want the user to be able to select 1 or all options that i listed when completing the form.

Thank you for your help!
Reply With Quote
  #2  
Old 09-19-2016, 03:52 PM
macropod's Avatar
macropod macropod is offline Multiple Selection Dropdown list Windows 7 64bit Multiple Selection Dropdown list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You might use code along the lines of:
Code:
Private Sub CommandButton1_Click()
Dim i As Long, StrOut As String
For i = 0 To Me.ListBox1.ListCount - 1
  If Me.ListBox1.Selected(i) Then
    StrOut = StrOut & Me.ListBox1.List(i) & vbCr
  End If
Next i
MsgBox StrOut
End Sub
As coded, the selections are simply reported in a message box. Presumably, you'll want to populate a bookmark, table cell, content control or something else but, without knowing exactly how you've defined the destination(s) in the document, only a generic guide can be given.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-19-2016, 03:56 PM
gmaxey gmaxey is offline Multiple Selection Dropdown list Windows 7 32bit Multiple Selection Dropdown list Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,600
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

As for "How do I insert ...," it sounds like you have already achieved that. If you want to populate it then something like this:

Code:
Sub Document_new()
  With ListBox1
    .Clear
    .MultiSelect = fmMultiSelectExtended
    .AddItem "A"
    .AddItem "B"
    .AddItem "C"
    .AddItem "D"
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #4  
Old 09-19-2016, 05:21 PM
ajanson ajanson is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2013
Novice
Multiple Selection Dropdown list
 
Join Date: Aug 2016
Posts: 9
ajanson is on a distinguished road
Default

Thank you so much for your resbonse, but i'm very new to VBA and i'm lost (i appologize!) but so far this is what i did:
1. I inserted from the developer tab under activex the listbox
2. Went to properties and changed the multi-select to 2.
3. Went to view code...... now what?

I pasted this and then turned design mode off, but there was no list.

If you can give me any pointers i would greatly appreciate. Sorry!!!
Reply With Quote
  #5  
Old 09-19-2016, 05:52 PM
macropod's Avatar
macropod macropod is offline Multiple Selection Dropdown list Windows 7 64bit Multiple Selection Dropdown list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Perhaps you could attach a document to a post with some representative data (delete anything sensitive) and your form, plus a description of what you want to have happen? You can attach a document to a post via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 09-20-2016, 06:26 AM
ajanson ajanson is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2013
Novice
Multiple Selection Dropdown list
 
Join Date: Aug 2016
Posts: 9
ajanson is on a distinguished road
Default sample doc attached

You can see that i used checkboxes instead, but i would rather have all of these types of services listed in a dropdown so the user is able to select multiple options. I inserted the dropdown beside so you can see. I'm just not sure what's next.

Thank you!
Attached Files
File Type: docx helpdoc.docx (14.3 KB, 127 views)
Reply With Quote
  #7  
Old 09-20-2016, 04:54 PM
macropod's Avatar
macropod macropod is offline Multiple Selection Dropdown list Windows 7 64bit Multiple Selection Dropdown list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See attached. You still haven't said, though, what you want done with the selected items.
Attached Files
File Type: docm helpdoc.docm (25.8 KB, 345 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 05-30-2018, 01:51 PM
Jailer Jailer is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2010 32bit
Novice
 
Join Date: May 2018
Posts: 7
Jailer is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
See attached. You still haven't said, though, what you want done with the selected items.
Hello. This document you posted in this post contains exactly what I am trying to do. Only thing I can't figure out is how to make it print to a bookmark in a word document instead of the pop up message box. Any idea on what I would need to add to make it do that?

Edit: Probably should have added, the list is on a userform and does not contain any external data.
Reply With Quote
  #9  
Old 07-15-2019, 07:48 PM
stephenwall stephenwall is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2016
Novice
 
Join Date: Jul 2019
Posts: 1
stephenwall is on a distinguished road
Default

I've just registered here as I'm trying to find a way to do the multi-select drop down in Word 2016 myself and am looking for options. I've downloaded your "helpdoc.docm" which is useful, but doesn't give me what I want exactly. I hope you can help?


I think the best option for me, based on what I've read so far is to use a userform with a drop down on it.



What I need to do is be able to:


1. Select a cell within a table in Word,
2. Have the form / drop down list pop up,
3. Select 1 or more options from the list,
4. Confirm and enter those choices into the table as text.
5. need to be able to re-select again by clicking in the cell (if possible)?


Would there be any change of getting another helpdoc.docm posted with the basics and code. Doesn't need to be pretty, I can format, etc.


Regards, Steve.
Reply With Quote
  #10  
Old 09-21-2016, 06:54 AM
ajanson ajanson is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2013
Novice
Multiple Selection Dropdown list
 
Join Date: Aug 2016
Posts: 9
ajanson is on a distinguished road
Default

Hello, Thank you very much. This is exactly what I was looking for, I just simply wanted to have a multiple-selection dropdown list using the types of services that I had in the checkboxes.

Only one problem though, when i open it I get an error in the code screen "Compile error Only valid in object module" - is there anyway around this? I really just want to copy what you did here and insert it into my doc Thank you so so much!
Reply With Quote
  #11  
Old 09-21-2016, 02:37 PM
macropod's Avatar
macropod macropod is offline Multiple Selection Dropdown list Windows 7 64bit Multiple Selection Dropdown list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't get that error when I open the document. Did you make any changes to it? You might also try repairing the Office installation (via Start > Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 09-22-2016, 06:59 AM
ajanson ajanson is offline Multiple Selection Dropdown list Windows 10 Multiple Selection Dropdown list Office 2013
Novice
Multiple Selection Dropdown list
 
Join Date: Aug 2016
Posts: 9
ajanson is on a distinguished road
Default

Thank you so very much macropod - it worked fine. I really do appreciate all of your help. Have a wonderful day!
Reply With Quote
  #13  
Old 07-11-2017, 08:35 PM
Chiku Chiku is offline Multiple Selection Dropdown list Windows Vista Multiple Selection Dropdown list Office 2016
Novice
 
Join Date: Jul 2017
Posts: 1
Chiku is on a distinguished road
Default Does not save the selection

But the worry is it does not store the selection once you close the file. Any luck how the selection/s could be saved for next session.
Reply With Quote
  #14  
Old 07-11-2017, 08:58 PM
macropod's Avatar
macropod macropod is offline Multiple Selection Dropdown list Windows 7 64bit Multiple Selection Dropdown list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,371
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That is by design (i.e. that's a necessary limitation of using ActiveX controls). If you want to save the selection(s) for a later session, you would need to modify the code to both store those selections (e.g. in the document body or metadata) and re-select them after re-populating the ListBox.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 02-27-2018, 01:54 AM
ms868 ms868 is offline Multiple Selection Dropdown list Windows 7 64bit Multiple Selection Dropdown list Office 2016
Novice
 
Join Date: Feb 2018
Posts: 5
ms868 is on a distinguished road
Default Selected entried into list

Hi

Is it possible to make the selected words from the dropdown appear in a list, instead of prompting, like in the example above?

Best regards

Martin
Reply With Quote
Reply

Tags
form, multi drop down



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Selection Dropdown list Change color according with dropdown selection spk Word VBA 43 07-31-2022 03:51 PM
Multiple Selection Dropdown list Auto text after selection from Dropdown menu trainsy Word 2 06-04-2014 04:43 AM
block selection in dropdown list Intruder Excel 2 01-10-2013 10:20 AM
Multiple Selection Dropdown list Dropdown selection value coconutt Word VBA 5 09-13-2012 05:23 PM
Multiple Selection Dropdown list Autofill a form which is contingent on a dropdown selection. biffle0764 Word 2 05-09-2012 12:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft