combo box populate

M

MEME

Hi,

I'm trying to add some values to my combo box. I have been reading how to
it, but it is not working.


Private Sub document_open()


Dim arrItems(4)
arrItems(0) = "Black"
arrItems(1) = "Blue"
arrItems(2) = "Green"
arrItems(3) = "Red"


ComboBox1.List = arrItems

end sub

IT is empty. What would be? Am I missing some switch to activate this
routine?

Thank you very much
 
R

Robert Martim, Excel

M

MEME

Hi Robert,

it is not in a userform. It is a template. I have tried document_open() and
document_new() . The combo box is empty.

Thanks
MEME
 
D

Doug Robbins - Word MVP

Use:

With ActiveDocument.InlineShapes(1).OLEFormat
.Activate
Set myObj = .Object
End With
With myObj
For i = 1 To 3
.AddItem "Item" & i
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

MEME

Hi,

Thank you for your reply. I don't understand where should I have this code.
(document_open() document_new())
Once again thanks
MEME
 
D

Doug Robbins - Word MVP

How are you planning to use the document?

If you are going to use it as a template, put that code inside a
Document_New() routine.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top