View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alex T Alex T is offline
external usenet poster
 
Posts: 24
Default Taking over OLEObjects... Possible ?!

Folks

Any chance to have the following code running ?

1. --- Class module

Option Explicit

Public WithEvents myObj As Excel.OLEObject

Private Sub myObj_GotFocus()

MsgBox "focus"

End Sub

2. --- Module

Option Explicit

Dim myButtons() As New clsMyOLEObj


Sub doStuff()

Dim x As OLEObject
Dim numItems As Integer


numItems = 0
For Each x In ActiveSheet.OLEObjects

numItems = numItems + 1
ReDim Preserve myButtons(1 To numItems)
Set myButtons(numItems).myObj = x

Next x

End Sub

The idea is to "take over" the OLEObjects and have one centralized
processing.

I'm doing (as per John Walkenbach
http://j-walk.com/ss/excel/tips/tip44.htm ) similar things with
userforms controls and it works well. However my code above fails when
assigning to myButtons(numItems).

Any idea ?


Thanks & regards

--AlexT