Hello again.
My mistake. I assumed the combobox was on a VBA userform, not in a document
type of form. The first code sample presumes that a userform has a combobox
called "cboItems" and a command button called "cmdReadUsingVBABuiltin". As it
stands this code won't work for a combobox in a Word document.
I'm guessing that you created the combobox using the Controls toolbar?
I've never tried before to populate one of those using VBA (except just now
as a test). One way that seems as though it might work is this:
I'm assuming that you're creating a template (.dot) and that the combobox's
name shows as "ComboBox1" when you view its code.
With the template open, get to the code window for the document itself. I
think you can do this by right-clicking the combobox in design mode and
choosing "View code" or by going into VBA and double-clicking the template's
"ThisDocument" module.
In the left-hand drop-down select "Document". Then in the right-hand
drop-down select "New". This creates an empty event handler which runs each
time a new document is created based on the template.
Copy the code from the sample (excluding the "Private Sub ..." and "End Sub"
lines) into the Document_New procedure. Change any occurrences of "cboItems"
to "ComboBox1".
Remove the Document_Change procedure.
Exit design mode, protect the form and save it.
Then create a new document based on the template (either through "File/New"
or by double-clicking it in Explorer), and see if it has worked.
(If you are creating a document (.doc) then in the above steps select "Open"
rather than "New" from the right-hand drop-down. This creates an empty event
handler which runs each time the document is opened.)
Regards.
Ed