![]() |
|
|
|
#1
|
||||
|
||||
|
In that case, you would need to test which content control was being used. That is easiest to do if you give each content control a title.
PS: He visitado Argentina cuatro veces (Bariloche, Calafate, El Chaltén), para caminar por los parques nacionales.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
Quote:
![]() ![]() ![]() ![]() Intentare tu metodo ya que realmente era justo lo que necesitaba. Thank you very much for all your help! If you come back to Argentina do not miss the Iguazu Falls ![]() I will try your method since it really was just what I needed. Un gran abrazo! |
|
#3
|
||||
|
||||
|
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#4
|
|||
|
|||
|
Thank u for helping me, thanks to your example I was able to solve the problem through tags ![]() ![]() ![]() ![]() ![]() ![]() Code:
Sub list1()
Application.ScreenUpdating = False
Dim strFolder$, strFile$, strDocNm$
strDocNm = ActiveDocument.FullName
strFile = Dir(ActiveDocument.Path & "\list1\*.doc", vbNormal)
Dim oThisdoc As Word.Document
Dim oCC As ContentControl
Dim oCCs As ContentControls
Set oThisdoc = ActiveDocument
Set oCCs = oThisdoc.SelectContentControlsByTag("List1")
For Each oCC In oCCs
If oCCs.Count > 0 Then
With oCC
.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 If
Next
End Sub
Sub list2()
Application.ScreenUpdating = False
Dim strFolder$, strFile$, strDocNm$
strDocNm = ActiveDocument.FullName
strFile = Dir(ActiveDocument.Path & "\list2\*.doc", vbNormal)
Dim oThisdoc As Word.Document
Dim oCC As ContentControl
Dim oCCs As ContentControls
Set oThisdoc = ActiveDocument
Set oCCs = oThisdoc.SelectContentControlsByTag("List2")
For Each oCC In oCCs
If oCCs.Count > 0 Then
With oCC
.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 If
Next
End Sub
Code:
Sub list_to_text()
Dim oThisdoc As Word.Document
Dim oCC As ContentControl
Dim oCCs As ContentControls
Dim sText As String
Set oThisdoc = ActiveDocument
Set oCCs = oThisdoc.SelectContentControlsByTag("List1")
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
For Each oCC In oCCs
If oCCs.Count > 0 Then
oCC.Range.Select
oCC.Delete False
sText = Application.Selection.Text
End If
Next
ChangeFileOpenDirectory ActiveDocument.Path & "\List1\"
Selection.InsertFile FileName:=sText, Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
Selection.TypeBackspace
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub
Last edited by thuriel; 11-15-2018 at 01:53 PM. |
|
| Tags |
| drop-down list |
|
|
Similar Threads
|
||||
| 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 |
How to get a Drop Down List Content Control box to fill in other areas
|
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 |