Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Could You Explain the difference?


Can you help understand why this code works:


Code:
--------------------
Sheets(1).Shapes("ComboBoxA").Select
Selection.ListFillRange = "lista2"
--------------------



and this one don't:



Code:
--------------------
Sheets(1).Shapes("ComboBoxA").ListFillRange = "lista2"
--------------------



Thank you all


Joe


--
jose luis
------------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=381040

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Could You Explain the difference?

Hi Jose,

jose luis wrote:
Can you help understand why this code works:
--------------------
Sheets(1).Shapes("ComboBoxA").Select
Selection.ListFillRange = "lista2"
--------------------

and this one don't:
--------------------
Sheets(1).Shapes("ComboBoxA").ListFillRange = "lista2"
--------------------


Sheets(1).Shapes("ComboBoxA") is an object of type "Shape". Thus, there is
no ListFillRange property available. When you first Select the object, then
Selection refers to the actual "DropDown" object, which does have a
ListFillRange property available. So that's why selecting it first works.

Another option is to use the OLEFormat and Object properties to get a
reference to the actual object type:

Sheets(1).Shapes("ComboBoxA").OLEFormat.Object.Lis tFillRange = "lista2"

Or you can use the DropDowns collection:

Sheets(1).DropDowns("ComboBoxA").ListFillRange = "lista2"

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Could You Explain the difference?

But this works:

Sheets(1).Shapes("ComboBoxA").DrawingObject.ListFi llRange = "lista2"

Shapes don't have a direct .listfillrange property. But lots of properties are
buried under other properties.

If you select
Sheets(1).Shapes("ComboBoxA")
and then add a watch (shift-F9)

You can see all those properties that that shape has.

You could also go right to the combobox itself:
Sheets(1).ComboBoxA.ListFillRange = "list2a"

Working with the selection hides lots of these properties--but then your code
has to select stuff.

jose luis wrote:

Can you help understand why this code works:

Code:
--------------------
Sheets(1).Shapes("ComboBoxA").Select
Selection.ListFillRange = "lista2"
--------------------

and this one don't:

Code:
--------------------
Sheets(1).Shapes("ComboBoxA").ListFillRange = "lista2"
--------------------

Thank you all

Joe

--
jose luis
------------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=381040


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Could You Explain the difference?


Thank you so much Jake and Dave for your prompt, complete and
understandable response (for novices like myself). I learned the
difference, and solve my programming problem. Hope to read you around
and be able in the near future to help others as you do today.

Thanks again

Jose Luis



jose luis Wrote:
Can you help understand why this code works:


Code:
--------------------
Sheets(1).Shapes("ComboBoxA").Select

Selection.ListFillRange = "lista2"

--------------------



and this one don't:



Code:
--------------------
Sheets(1).Shapes("ComboBoxA").ListFillRange = "lista2"

--------------------



Thank you all


Joe



--
jose luis
------------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=381040

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Could You Explain the difference?

One of the differences between parts of our suggestions is that I used a
combobox from the control toolbox toolbar. Jake used a dropdown/combobox from
the Forms toolbar.



jose luis wrote:

Thank you so much Jake and Dave for your prompt, complete and
understandable response (for novices like myself). I learned the
difference, and solve my programming problem. Hope to read you around
and be able in the near future to help others as you do today.

Thanks again

Jose Luis

jose luis Wrote:
Can you help understand why this code works:


Code:
--------------------
Sheets(1).Shapes("ComboBoxA").Select

Selection.ListFillRange = "lista2"

--------------------



and this one don't:



Code:
--------------------
Sheets(1).Shapes("ComboBoxA").ListFillRange = "lista2"

--------------------



Thank you all


Joe


--
jose luis
------------------------------------------------------------------------
jose luis's Profile: http://www.excelforum.com/member.php...o&userid=13312
View this thread: http://www.excelforum.com/showthread...hreadid=381040


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Could You Explain the difference?

Dave Peterson wrote:
One of the differences between parts of our suggestions is that I
used a combobox from the control toolbox toolbar. Jake used a
dropdown/combobox from the Forms toolbar.


And I always guess wrong, so he probably wanted information on the ActiveX
version. <g

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Could You Explain the difference?

If we both usually guess wrong, do we get stuck with Rod Serling!

Jake Marx wrote:

Dave Peterson wrote:
One of the differences between parts of our suggestions is that I
used a combobox from the control toolbox toolbar. Jake used a
dropdown/combobox from the Forms toolbar.


And I always guess wrong, so he probably wanted information on the ActiveX
version. <g

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
please explain the difference between linking data from separate . Lswb Excel Discussion (Misc queries) 1 July 23rd 08 10:19 AM
difference between word 2003 menus and word 2007 menus-Explain pl kali Excel Discussion (Misc queries) 1 August 29th 07 07:56 AM
Can you explain the difference & How to use: Combo Box/List Box? SMGray Excel Discussion (Misc queries) 2 January 11th 06 09:06 AM
charting a difference of 2 columns' w/o adding a difference column Wab Charts and Charting in Excel 4 July 27th 05 02:37 AM
Explain these please Sal Excel Worksheet Functions 1 March 24th 05 08:43 PM


All times are GMT +1. The time now is 10:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"