Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default ComboBox .List problem

I'm using VB6 to create Excel files and add .bas files to it. From VB6, I'm
running a subroutine (macro) in the Excel file (it belongs to a .bas file I
just added) that adds an Excel Forms combobox to a sheet and sets its source
to a named range on another sheet. Here's the code snippet I'm running:
Set CB = WS.DropDowns.Add(Left, Top, 128.25, 15.75) '(Left, Top, Width,
Height)
With CB
.Name = Name
.ListFillRange = Source
.ListIndex = 0
.DropDownLines = 8
.Display3DShading = False
.OnAction = Name & "_Change"
End With

This all appears to be working (except the .ListIndex is not actually
setting the text of the combobox to the first value - this is not my real
problem).
Next, I'm running the Change event of the combobox I just added (I also
added the Change event subroutine through code, in case that matters). In it
I have the following line:
SelectedValue =
WS.DropDowns("cmbServices").List(WS.DropDowns("cmb Services").ListIndex)
When I'm in VB6 running this as a macro, the above line errors off saying
"Unable to get the List property of the DropDown class". However, if I save
the Excel file and open it, then this line of code works perfectly.
Any ideas?
Thx.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default ComboBox .List problem

One other note is that the second part of the line is working. In
SelectedValue =
WS.DropDowns("cmbServices").List(WS.DropDowns("cmb Services").ListIndex)
The WS.DropDowns("cmbServices").ListIndex does contain a value of zero. So,
it does see the object.
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
.AddItem list and populating combobox with created list pallaver Excel Discussion (Misc queries) 8 June 27th 08 12:36 PM
Change Combobox list to list more than 1 cell.value Corey Excel Programming 1 January 4th 07 09:31 PM
Combobox list to leave ONLY related values in list ?? Corey Excel Programming 2 January 4th 07 09:13 PM
Combobox List to list Numerical Values ONLY in Column A is specific Sheet.... Corey Excel Programming 5 December 28th 06 10:40 AM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM


All times are GMT +1. The time now is 10:42 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"