#1
|
|||
|
|||
Listbox Content Control - Reset default/prompt?
Let's say we have a list box. We have there a prompt "Pick value" and the options are "1", "2" and "3". User picks value "3". Now in order to reset this value to "Pick value", what do I need?
This Code:
Dim obj Set obj = ActiveDocument.ContentControls(2) obj.Range.Text = obj.PlaceholderText.Value And yes, I've asked this elsewhere too. |
#2
|
||||
|
||||
That's as simple as:
Code:
ActiveDocument.ContentControls(2).Range.Text = ""
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Unfortunately it isn't and will produce the same error. For a list box the code required is
Code:
ActiveDocument.ContentControls(2).DropdownListEntries(1).Select
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#4
|
|||
|
|||
Quote:
The best option I've found so far has been to re-create the entire list. It is a lot of hopefully completely needless code, but that's the best solution I've found working. |
#5
|
||||
|
||||
It worked when I tried it before posting, but when I re-tried it just now, it didn't. Another way would be:
Code:
With ActiveDocument.ContentControls(2) .Type = wdContentControlText .Range.Text = "" .Type = wdContentControlDropdownList End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
This works, thanks!
|
#7
|
||||
|
||||
That is suitably ingenious. Good one
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#8
|
||||
|
||||
Cross-posted at: http://www.vbaexpress.com/forum/show...-Reset-default
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Clicking the selected Content Control checkbox returns wrong control in vba event | DougsGraphics | Word VBA | 2 | 06-24-2015 07:31 AM |
How to set the Content Control placeholder default text | dsimon14 | Word VBA | 3 | 03-27-2015 07:15 AM |
How to use an ActiveX Control to insert a multi select listbox in Word | marksm33 | Word | 2 | 01-29-2014 05:21 PM |
Deleting a table from a content control -- preserving the content control | BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |
text appears in prompt font in RTF content control | eli.rhodes | Word | 1 | 09-18-2013 08:32 AM |