Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 9th, 2009, 05:51 PM
Registered User
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA Excel OleObject Event LostFocus fails to work

Hello,

in my excel sheet I try to create oleObject Controls as the user clicks certain cells.

Creating them is no problem:
Code:
'Excel sheet object

Set oleObj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.ComboBox.1")
oleObj.Left = rIntersect.Left
oleObj.Top = rIntersect.Top
oleObj.Width = rIntersect.Width
oleObj.Height = rIntersect.Height
oleObj.LinkedCell = rIntersect(1, 1).AddressLocal(, , xlA1)
Then I try to link the created oleObject to an instance of a class which enables eventhandling:
Code:
'Class module cOleObjectEvent

Public WithEvents myObj As OLEObject

Private Sub myObj_LostFocus()
     myObj.Delete
End Sub
Code:
'Excel sheet object

If OleObjEvent Is Nothing Then Set OleObjEvent = New cOleObjectEvent
Set OleObjEvent.myObj = oleObj
        
oleObj.Activate
When the code runs, it generates an error at the line where I try to make the link to the instance of the event handling class, giving the error message "Object or class does not support the set of events"

Any suggestions would be very helpfull

Thanx,

Tom

Last edited by vanzieto; April 9th, 2009 at 05:58 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
vba work outlook with excel sheet qunatphil Excel VBA 1 April 16th, 2008 12:30 PM
DTC fails to work with SQL Server after changing t titojermaine SQL Server 2005 0 July 24th, 2007 07:24 AM
Automatically Event Repeat in Excel VBA ? plz help poorheler Excel VBA 1 July 4th, 2007 06:37 AM
TRIM, ISTEXT function won't work in Excel VBA code munzer1 Excel VBA 1 May 29th, 2007 09:35 AM
lostfocus event mateenmohd Access 2 May 28th, 2006 03:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.