> I have created a listbox in a word doc. When I work on this document,
> the listbox is filled in. But if I save, close then open the doc
> again, the listbox empties. How can I avoid that?
> Thanks.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
> Armelderoeck was telling us:
> Armelderoeck nous racontait que :
[quoted text clipped - 7 lines]
> How was it created and filled in the first place?
> What Word version?
The list box is in my Word doc, included in the text (placed in a table). I
just created it under Word 2007 with the 'developper' section, with the
simple control that is furbished in this view.
For the moment, I use the solution hereafter:
When closing the docx, a macro runs and fills a text box, turning the
contents of my listbox into a XML format.
Another macro is launched when opening the docx that 'reads' the XML and
fills in the listbox again.
So, on my side, I have solved the problem, but some other people could have
it...
Another thing: why does Word bugs when I use the mouse wheel over the
listbox???
Thanks for your answer anyway,
A plus!
Jean-Guy Marcil - 04 Nov 2006 17:43 GMT
Armelderoeck was telling us:
Armelderoeck nous racontait que :
>> Armelderoeck was telling us:
>> Armelderoeck nous racontait que :
[quoted text clipped - 27 lines]
>
> Thanks for your answer anyway,
If you add content through VBA, the content will be gone when you next open
the document, except for the item that might have been chosen by the user.
If you do not want to use XML, you have two options:
VBA:
'_______________________________________
Private Sub Document_New()
FillDropDown
End Sub
'_______________________________________
'_______________________________________
Private Sub Document_Open()
FillDropDown
End Sub
'_______________________________________
'_______________________________________
Sub FillDropDown()
Dim cctrlDrop As ContentControl
Set cctrlDrop = ActiveDocument.Tables(1).Range.ContentControls(1)
With cctrlDrop
.Title = "List Test"
.SetPlaceholderText , , "List filled when creating/opening document."
.DropdownListEntries.Add "Option 1"
.DropdownListEntries.Add "Option 2"
.DropdownListEntries.Add "Option 3"
.DropdownListEntries.Add "Option 4"
End With
End Sub
'_______________________________________
GUI:
Insert your Dropdown, select it, then on the Developer tab, click on
"Properties"
Use the Add button to add your entries.
When you are done (Or before, it does not matter when), you may want to lock
the control down. But this has no bearing on list content retention from one
Word session to the next.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org