Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2019, 06:42 PM
justinmo justinmo is offline Is there a way to export the contents of a Word drop down list? Windows 10 Is there a way to export the contents of a Word drop down list? Office 2016
Novice
Is there a way to export the contents of a Word drop down list?
 
Join Date: Sep 2018
Posts: 7
justinmo is on a distinguished road
Default Is there a way to export the contents of a Word drop down list?


I have a Word 365 document containing a long drop down list in the form of a Bounding Box. I would like to export the contents of the entire list, make some tweaks, then import the updated list. Is this possible?
Reply With Quote
  #2  
Old 01-17-2019, 08:52 PM
Guessed's Avatar
Guessed Guessed is offline Is there a way to export the contents of a Word drop down list? Windows 10 Is there a way to export the contents of a Word drop down list? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Are you talking about a Content Control? If so, there isn't an easy way that I know of but you could do it with a couple of macros that would take a bit of work to create.

An easier alternative if you aren't scared by xml is to find the relevant part in the document.xml file and edit it there. Looking at the xml to find the entries of a Dropdown Content Control shows that the list entries follow a simple enough pattern
Code:
<w:dropDownList>
<w:listItem w:value="Choose an item."/><w:listItem w:displayText="one" w:value="one"/><w:listItem w:displayText="two" w:value="two"/><w:listItem w:displayText="three" w:value="three"/><w:listItem w:displayText="four" w:value="fourish"/><w:listItem w:displayText="five" w:value="and a bit"/><w:listItem w:displayText="six" w:value="keep testing me"/>
</w:dropDownList>
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 01-17-2019, 08:56 PM
macropod's Avatar
macropod macropod is offline Is there a way to export the contents of a Word drop down list? Windows 7 64bit Is there a way to export the contents of a Word drop down list? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Bounding Box? What kind of dropdown (formfield, content control, ActiveX control, AutoTextList field, userform object) are you using? There is a 'Bounding Box' display property for content controls in more recent versions of Word, but that isn't supported in Word 2010 & earlier, for example.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 01-17-2019, 09:40 PM
gmayor's Avatar
gmayor gmayor is offline Is there a way to export the contents of a Word drop down list? Windows 10 Is there a way to export the contents of a Word drop down list? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If it is a content control list or combo box, you could use my Content Control Tools (Add/Remove/Edit Content Control List Entries) http://www.gmayor.com/insert_content_control_addin.htm to edit the list.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 01-18-2019, 12:02 AM
justinmo justinmo is offline Is there a way to export the contents of a Word drop down list? Windows 10 Is there a way to export the contents of a Word drop down list? Office 2016
Novice
Is there a way to export the contents of a Word drop down list?
 
Join Date: Sep 2018
Posts: 7
justinmo is on a distinguished road
Default

The type of drop down I am using is content control
Reply With Quote
  #6  
Old 01-18-2019, 01:59 PM
macropod's Avatar
macropod macropod is offline Is there a way to export the contents of a Word drop down list? Windows 7 64bit Is there a way to export the contents of a Word drop down list? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Try:
Code:
Sub ExportList()
Dim i As Long, StrList As String
With Selection.Range
  If .ContentControls.Count = 0 Then Exit Sub
  With .ContentControls(1)
    If .Type = wdContentControlComboBox Or .Type = wdContentControlDropdownList Then
      For i = 2 To .DropdownListEntries.Count
        StrList = StrList & Chr(11) & .DropdownListEntries(i).Text & vbTab & .DropdownListEntries(i).Value
      Next
    End If
  End With
  .Characters.Last.InsertBefore StrList
End With
End Sub
and:
Code:
Sub ImportList()
Dim i As Long, StrList As String, Rng As Range, t As Long
With Selection.Range
  If .ContentControls.Count = 0 Then Exit Sub
  If .Characters.Last = vbCr Then .End = .End - 1
  With .ContentControls(1)
    t = .Type
    If t = wdContentControlComboBox Or t = wdContentControlDropdownList Then
      Set Rng = Selection.Range
      Rng.Start = .Range.End
      .DropdownListEntries.Clear
      For i = 1 To UBound(Split(Rng.Text, Chr(11)))
        .DropdownListEntries.Add Text:=Split(Split(Rng.Text, Chr(11))(i), vbTab)(0), _
          Value:=Split(Split(Rng.Text, Chr(11))(i), vbTab)(1)
      Next
      .Type = wdContentControlText
      .Type = t
      'Rng.Text = vbNullString
    End If
  End With
End With
End Sub
It is assumed the content control is followed by a paragraph break, which must be included in the selection for export. The content control and entry list must be re-selected for import. Do not delete the exported tabs unless the entire entry is deleted; any new entries must likewise contain a tab. The commented-out:
'Rng.Text = vbNullString
can be used to automatically delete the list once it's been imported.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 01-18-2019, 03:57 PM
justinmo justinmo is offline Is there a way to export the contents of a Word drop down list? Windows 10 Is there a way to export the contents of a Word drop down list? Office 2016
Novice
Is there a way to export the contents of a Word drop down list?
 
Join Date: Sep 2018
Posts: 7
justinmo is on a distinguished road
Default

@macropod - that code worked perfectly. Thank you so much!
Reply With Quote
Reply

Tags
bounding box, export drop down list, word 365

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to export the contents of a Word drop down list? How to import list from Excel into drop-down list into word ahw Word VBA 43 02-28-2020 08:11 PM
Is there a way to export the contents of a Word drop down list? Export Word Drop-Down Content Control to Excel Specific Sheet nolanthomas32 Word VBA 4 09-19-2017 06:25 AM
Drop down list for word doc Ivylodge Word 7 08-09-2017 06:15 AM
Is there a way to export the contents of a Word drop down list? Having a Drop-down list in Word referring to an Excel list celias Word VBA 3 07-11-2016 11:40 PM
Is there a way to export the contents of a Word drop down list? Populating ComboBox or Drop Down list with contents of a text field Billy_McSkintos Word VBA 1 09-13-2011 05:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:42 AM.


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