Error with OLEObjest

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
Error with OLEObject
Hi there
My problem is : when excution gets to this line:
Code:
Set cboTemp = ws.OLEObjects("TempCombo")
it gives me
Code:
Methode of OLEObjest of worksheet Failed
Any how to solve the Error ?

Here is the whole code:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) 
Dim str As String 
Dim cboTemp As OLEObject 
Dim ws As Worksheet 
Set ws = ActiveSheet 

Set cboTemp = ws.OLEObjects("TempCombo") 
  On Error Resume Next 
If cboTemp.Visible = True Then 
  With cboTemp 
    .Top = 10 
    .Left = 10 
    .ListFillRange = "" 
    .LinkedCell = "" 
    .Visible = False 
    .Value = "" 
  End With 
End If 

errHandler: 
  Application.EnableEvents = True 
  Exit Sub 
  
End Sub
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Are you sure it's an OLEObject (Control from the Control Toolbox). If it is make sure its name is "TempCombo".
 

Watch MrExcel Video

Forum statistics

Threads
1,118,760
Messages
5,574,083
Members
412,566
Latest member
TexasTony
Top