LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ComboBox on a Sheet

Sub abc()
Dim ole As OLEObject
Dim cbox As MSForms.Combobox
Dim cell as Range

Set ole = ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.ComboBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=67.5, _
Top:=275.25, _
Width:=63, _
Height:=40.5)
Set cbox = ole.Object
cbox.Name = "MyCombo"
for each cell in Range("sheet1!A1:A10")
ole.Object.AddItem cell.Value
Next
cbox.ListIndex = 3
Msg = "MyCombo has a value of " & _
ActiveSheet.OLEObjects("MyCombo").Object.Value
MsgBox Msg

End Sub

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
This works great.

But is it possible to add the items to the ole object from within VBA
(using an assignment statement) rather than from a range.

Thanks!



 
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
RowSource for Sheet ComboBox Minitman Excel Worksheet Functions 3 March 24th 08 09:43 PM
How do I put hyperlinks to another sheet in a combobox? Meinarsson Excel Discussion (Misc queries) 0 July 25th 07 03:04 PM
Sheet combobox help IT_roofer Excel Worksheet Functions 2 May 15th 07 05:16 PM
combobox/copying sheet joe smith Excel Discussion (Misc queries) 2 March 29th 05 03:55 PM
ActiveX ComboBox Control on Sheet quartz[_2_] Excel Programming 2 January 13th 05 06:31 PM


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

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

About Us

"It's about Microsoft Excel"