Sub abc()
v = Array(1, 2, 3, 4, 5)
ActiveSheet.OLEObjects("ListBox1").Object.List = v
End Sub
Sub abc1()
For i = 1 To 7
ActiveSheet.OLEObjects("Listbox2").Object.AddItem i
Next
End Sub
so
Dim myDoc As Worksheet
Dim list As Variant
list = ThisWorkbook.Sheets("Sheet1").Range("A2:A4").Value
Set myDoc = ThisWorkbook.Sheets("Sheet1")
myDoc.OleObjects("ListBox1").Object.list = list ' populate the listbox
' or
myDoc.OleObjects("ListBox1").Object.AddItem "Whatever"
--
Regards,
Tom Ogilvy
"rash" wrote in message
...
Ok here it goes.
AddItem dosent work, nor dose list.
Kind regards
Code:
--------------------
Dim myDoc As Worksheet
Dim list As Variant
list = ThisWorkbook.Sheets("Sheet1").Range("A2:A4").Value
Set myDoc = ThisWorkbook.Sheets("Sheet1")
myDoc.Shapes("ListBox1").list = list ' populate the listbox
myDoc.Shapes("ListBox1").ControlFormat.AddItem ("Whatever")
--------------------
Norman Jones Wrote:
Hi Rash,
Try posting your code which fails.
---
Regards,
Norman
"rash" wrote in
message
...
Hi, I want to fill a listbox thru VBA not connecting a range to it.
Every thing I tru (such as AddItem method) result i the error msg
"The
Object dosent support his method or property" Even if I copy the
Excel
Help Example, why is that?
Kind regards!
--
rash
------------------------------------------------------------------------
rash's Profile:
http://www.excelforum.com/member.php...o&userid=29765
View this thread:
http://www.excelforum.com/showthread...hreadid=494825
--
rash
------------------------------------------------------------------------
rash's Profile:
http://www.excelforum.com/member.php...o&userid=29765
View this thread: http://www.excelforum.com/showthread...hreadid=494825