Userform to update a drop down form field list

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Userform to update a drop down form field list

Post by ABabeNChrist »

Can a userform be used to view, add new or modify the list in a selected drop down form field and to also insert one or more of those comments in list to a target bookmark.

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Userform to update a drop down form field list

Post by HansV »

Yes, but you'd have to create a custom keyboard shortcut and/or custom ribbon button to activate the userform.

How can we associate a bookmark with a dropdown?

By the way, why are you trying to redo your Excel workbook in Word?
Best wishes,
Hans

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Userform to update a drop down form field list

Post by ABabeNChrist »

I know have to create a custom ribbon button (s) and to populate a targeted bookmark using a userform using the code below, but not how to have an option to modify the existing verbiage, or change exiting verbiage with the help of targeted Form fields or update new verbiage to the form fields with the assistance of a userform.

Code: Select all

Private Sub CommandButton1_Click()
        Dim oRng As Word.Range
        Dim oBM As Bookmarks
        Set oBM = ActiveDocument.Bookmarks
        
    If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
        ActiveDocument.Unprotect ""
    End If
        
    'Company Info
        Set oRng = oBM("CompanyName").Range
        oRng.Text = Me.TextBox35.Text
        oBM.Add "CompanyName", oRng
        
        Set oRng = oBM("CompanyAddress").Range
        oRng.Text = Me.TextBox35.Text
        oBM.Add "CompanyAddress", oRng
        
        MsgBox ("Your company information has been updated")
        
        Call UpdateAllFields
        ActiveDocument.Protect wdAllowOnlyFormFields, True, ""

        UserForm1.Hide
End Sub
HansV wrote: By the way, why are you trying to redo your Excel workbook in Word?
That is very observant of you :grin:
Even though I like the Excel approach, Excel rows do not flow the verbiage from page to page as in Word and can create gaps/open white space, also the Excel row space is limited and Word is not.

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Userform to update a drop down form field list

Post by HansV »

See if the attached document helps you on your way.
Userform4Dropdown.docm
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Userform to update a drop down form field list

Post by ABabeNChrist »

That was very interesting. Its seems to do all except, there are many occasions when there may be multiple concerns that would need to be addressed and only being able to select one selection from the list for that targeted selection would limit this. Being able to select multiple from the list would be ideal (cherry on the top)

User avatar
HansV
Administrator
Posts: 78474
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Userform to update a drop down form field list

Post by HansV »

You can set the MultiSelect property of the list box to 1 - fmMultiSelectMulti (or to 2 - fmMultiSelectExtended).
Best wishes,
Hans