![]() |
#4
|
||||
|
||||
![]()
A dropdown list in Word is less dynamic than a file open dialogue, since you would need to repopulate the list every time you access it to ensure it remains current. Also, adding more files to the list wouldn't add them to the folder. To populate and keep refreshed your content control with such a list you might use code like the following in your document's 'ThisDocument' code module:
Code:
Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl) Application.ScreenUpdating = False Dim strFolder As String, strFile As String, strDocNm As String strDocNm = ActiveDocument.FullName strFolder = ActiveDocument.Path strFile = Dir(strFolder & "\*.doc", vbNormal) With CCtrl .DropdownListEntries.Clear .Type = wdContentControlText .Range.Text = "" .Type = wdContentControlDropdownList While strFile <> "" If strFolder & "\" & strFile <> strDocNm Then .DropdownListEntries.Add strFile End If strFile = Dir() Wend End With Application.ScreenUpdating = True End Sub To retain the previous selection, omit: Code:
.Type = wdContentControlText .Range.Text = "" .Type = wdContentControlDropdownList
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
drop-down list |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Drop down box list based on response to another drop down box | Phideaux | Excel | 16 | 04-13-2018 03:07 AM |
Document with drop down field for attorney. How to fill in the address etc in other fields. | ElfegoBaca | Word | 3 | 09-27-2017 09:00 AM |
![]() |
snips1982 | Word | 2 | 03-22-2017 03:37 AM |
Fill - White, Drop Shadow formatting in PP 2013 | dave3point0 | PowerPoint | 2 | 12-28-2015 04:23 PM |
Populate Word Drop-down list with Excel column then auto fill form fields with Excel data | Faldinio | Word VBA | 7 | 10-19-2014 06:03 AM |