Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need to cast OleObject to CombBbox
Hello,
I would need to cast an OleObject into a Combobox because VBA Excel doesn't seem to do it implicitely That is for using the AddItem method on it (this method is not supported by the OleObject) This is my code ' OleObject(1) is supposed to be a combobox ActiveSheet.OleObjects(1).AddItem "Hello" Can someone help me please ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need to cast OleObject to CombBbox
OleObject(1) is supposed to be a combobox
if typeof OleObjects(1).Object is MSForms.Combobox then ActiveSheet.OleObjects(1).Object AddItem "Hello" End if additem is a method of the combobox. OleObjects(1).Object is the combobox for example: Sub Tester3() Dim rng As Range Dim cell As Range Set rng = Range(Cells(3, "A"), _ Cells(Rows.Count, "A").End(xlUp)) For Each cell In rng ActiveSheet.OLEObjects(1).Object.AddItem cell.Text Next End Sub -- Regards, Tom Ogilvy "Liline" wrote in message ... Hello, I would need to cast an OleObject into a Combobox because VBA Excel doesn't seem to do it implicitely That is for using the AddItem method on it (this method is not supported by the OleObject) This is my code ' OleObject(1) is supposed to be a combobox ActiveSheet.OleObjects(1).AddItem "Hello" Can someone help me please ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to cast com object (interop) | Excel Discussion (Misc queries) | |||
How do I cast time when the total exceeds 24 hours | Excel Discussion (Misc queries) | |||
CAST Function | Excel Discussion (Misc queries) | |||
OLEobject on the sheet | Excel Programming | |||
Using a variable to represent a Checkbox Name(OLEObject) | Excel Programming |