Oleobject TYpe??? Tyfe of ctrl is combobox

galileogali

Well-known Member
Joined
Oct 14, 2005
Messages
748
I have two controls, Oleobjects on the Worksheet. I want to go OleOjects with VBA and recognize what type Combobox. How is this property get?


Sub limpiarCmbs()
Dim ctrl As OLEObject
For Each ctrl In ActiveSheet.OLEObjects

If ctrl.??????= "Forms.ComboBox.1" Then
ctrl.Text = vbNullString
End If
Next
End Sub
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

galileogali

Well-known Member
Joined
Oct 14, 2005
Messages
748
with this solution, the issue were resolved

Option Explicit
Sub auto_open()

Code:
Dim OLEObj As OLEObject
Dim wks As Worksheet
Dim iCtr As Long

For Each wks In ThisWorkbook.Worksheets
For Each OLEObj In wks.OLEObjects
If TypeOf OLEObj.Object Is MSForms.ComboBox Then
For iCtr = 1 To 10
OLEObj.Object.AddItem "A" & iCtr
Next iCtr
End If
Next OLEObj
Next wks

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,108,730
Messages
5,524,491
Members
409,584
Latest member
RedHelp

This Week's Hot Topics

Top