PC Review


Reply
Thread Tools Rate Thread

ControlFormat Problem

 
 
equiangular
Guest
Posts: n/a
 
      28th Feb 2007
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.
 
Reply With Quote
 
 
 
 
Doug Glancy
Guest
Posts: n/a
 
      28th Feb 2007
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

"equiangular" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
equiangular
Guest
Posts: n/a
 
      28th Feb 2007
It seems that ControlFormat is a special case.

Thanks a lot.

Doug Glancy wrote:
> 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
>
> "equiangular" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set label text of controlformat hoho sklo Microsoft Excel Programming 7 30th Oct 2008 08:47 AM
controlformat.enabled failed in excel macro DAACKM Microsoft Excel Programming 1 15th Sep 2008 05:32 PM
XL2007 Bug: ControlFormat in "For each" =?Utf-8?B?Q2hyaXN0b3BoZXIgS2luZw==?= Microsoft Excel Programming 1 22nd Mar 2007 05:50 PM
ThisWorkbook.Saved = True does not work when Shapes().ControlFormat.Enabled = False Joe HM Microsoft Excel Programming 0 3rd Aug 2006 07:46 PM
Shape ControlFormat.LinkedCell returns wrong Address for named range - BUG bowlegtroy@hotmail.com Microsoft Excel Programming 10 14th Jul 2006 03:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:57 AM.