Tuesday, 15 June 2010

vba - I'm not able to get the selected value from ContentControl and I'm not able also to set the value I want -



vba - I'm not able to get the selected value from ContentControl and I'm not able also to set the value I want -

i'm trying create dependent drop-down list user may select first drop-down list , other dependent drop-down list alter automatically.

select case contentcontrol.title case "t1_1" select case contentcontrol.dropdownlistentries.item.value case "male" activedocument.selectcontentcontrolsbytitle("t1_2").item(1).value = "male" activedocument.selectcontentcontrolsbytitle("t1_3").item(1).value = "male" activedocument.selectcontentcontrolsbytitle("t1_4").item(1).value = "male" case "female" activedocument.selectcontentcontrolsbytitle("t1_2").item(1).value = "female" activedocument.selectcontentcontrolsbytitle("t1_3").item(1).value = "female" activedocument.selectcontentcontrolsbytitle("t1_4").item(1).value = "female" end select

i'm not able selected value "male or female" , i'm not able set value want.

from looked time ago, microsoft forgot allow query selected value of dropdown-contentcontrol. can contentcontrol.range.text, if need corresponding shorthand-value, have loop through:

public function getccdd_value(cc contentcontrol) string getccdd_value = "" each item in cc.dropdownlistentries if item.text = cc.range.text getccdd_value = item.value end if next end function

for changing, can set contentcontrol's .range.text. must match existing dropdown-listentries-text (case sensitive) in order homecoming right value afterwards.

vba word-vba

No comments:

Post a Comment