ControlFormat Problem

E

equiangular

Sub test()
Dim cf As ControlFormat
Set cf = Worksheets("sheet1").Shapes("Drop Down 1").ControlFormat
cf.List = Array("a", "b") ' <-- error line
End Sub


The code works perfectly if i use Worksheets("sheet1").Shapes("Drop Down
1").ControlFormat.List = Array("a", "b").

Why this is so?

Thanks.
 
D

Doug Glancy

When I F1 over ControlFormat it seems that it's both a Property and an
Object, which has something to do with why one case works and the other
doesn't, I think.

How about this instead?:

Sub test()
Dim dd As DropDown
Set dd = Worksheets("sheet1").DropDowns("Drop Down 1")
dd.List = Array("a", "b") ' <-- error line
End Sub

hth,

Doug
 

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