![]() |
#6
|
||||
|
||||
![]()
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 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 'Rng.Text = vbNullString can be used to automatically delete the list once it's been imported.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
bounding box, export drop down list, word 365 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ahw | Word VBA | 43 | 02-28-2020 08:11 PM |
![]() |
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 |
![]() |
celias | Word VBA | 3 | 07-11-2016 11:40 PM |
![]() |
Billy_McSkintos | Word VBA | 1 | 09-13-2011 05:50 AM |