Thread: [Solved] How to unlock Drop-Down list
View Single Post
 
Old 05-05-2011, 06:47 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
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

Hi Ikks,

Dropdown formfields don’t support text entry. To provide that facility, you could provide an option in the dropdown for 'free text' and use an on-exit macro with an Inputbox to insert the user’s 'free text' into the dropdown. For example, suppose you have a dropdown with 5 items, the last of which offers free text entry (e.g. an 'Other' option). Adding the following on-exit macro to the formfield will provide that:
Code:
Sub FreeText()
Dim StrNew As String, i As Long
With Selection.FormFields(1).DropDown
  i = .ListEntries.Count
  If .Value = i Then
    StrNew = Trim(InputBox("Input your text", "Data Entry", .ListEntries(i).Name))
    If StrNew = vbNullString Then Exit Sub
      .ListEntries(i).Delete
      .ListEntries.Add StrNew
      .Value = i
  End If
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote