Thread: [Solved] date picker in dropdown list
View Single Post
 
Old 08-11-2020, 11:31 AM
chriscla chriscla is offline Windows 10 Office 2013
Novice
 
Join Date: Mar 2020
Posts: 18
chriscla is on a distinguished road
Default solution

Thanks for the input. I solved it as Guessed suggested by using building blocks as a reply to the choice made in the dropdown list, where:
- when the check has been done: 'check done' in dropdown and date picker in building block 'DoorlopenJa'
- when the check has been done without knowing the date: 'check done, but date unknown' in dropdown, '. ' in building block 'DoorlopenNee'. I could do this because the dropdown is at the end of a sentence.
- when the check has not been done: 'check not done' in dropdown, '. ' in building block 'DoorlopenNee'.

This may not be the most attractive way to do it, but it does the job.

Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long
Dim oCC As ContentControl
    With ContentControl
        Select Case .Title
Case Is = "doorlopenJN"
                If .ShowingPlaceholderText = True Then
                    Set oCC = ActiveDocument.SelectContentControlsByTitle("doorlopenTekst").Item(1)
                    oCC.LockContentControl = True
                    oCC.Range.Text = ""
                Else
                    For i = 1 To .DropdownListEntries.Count
                        If .DropdownListEntries(i).Text = .Range.Text Then
                            Select Case .DropdownListEntries(i).Text
                                Case "doorlopen "
                                    AutoTextToCC "doorlopenTekst", ActiveDocument.AttachedTemplate, "DoorlopenJa"
                                Case "doorlopen, datum niet gekend"
                                    AutoTextToCC "doorlopenTekst", ActiveDocument.AttachedTemplate, "DoorlopenNee"
                                Case "niet doorlopen"
                                    AutoTextToCC "doorlopenTekst", ActiveDocument.AttachedTemplate, "DoorlopenNee"
                            End Select
                            Exit For
                        End If
                    Next
                End If
        End Select
    End With
End Sub
Thanks again to Guessed and gmaxey to point me in the right direction.
Reply With Quote