Home > Back-end >  Need help to get the VBA code auto select fields from Content Control drop down options
Need help to get the VBA code auto select fields from Content Control drop down options

Time:01-12

Can anyone help me with auto populating value from content control drop down option. I have four options in the drop down list and I want option 1 to be populated for Case Methodology.

While trying the below code is giving me VBA 6124 error- You can not edit it because it is protected,

Select Case oCC.Title
            Case "Methodology"
                oCC.Range.Text = " abc"
            Case "Methodology2"
                oCC.Range.Text = "NA"

I tried .LockContents=False but it is not working either. Please help me to provide the code that can autoselect first value from the four options

CodePudding user response:

As this is a dropdown content control, Range.Text is read-only.

You have to use:

oCC.DropdownListEntries(2).Select

2 because usually the placeholder text is the first in your list.

  • Related