View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Problem activating OLEObjects

Peter,

it's not clear (to me) what exactly your trying to achieve?
or what the problem is..




activating/selecting them is generally counter productive.

If you set the listindex, remember that you trigger a few events..
depending on the eventhandlers you may have set for these controls
these WILL be handled. (or need to)
you may need to either disable events or include Doevetns for this
stuff to be handled correctly.


Or is the the screen that doesn't update?
(I've found that toggling the .visible property solves this best)






--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Peter Fopma wrote :

On my Excel Worksheet I try to update ComboBoxes via
programm code.

Using the ListIndex attribute of the ComboBox does
not work - Updating is delayed until my subroutine exits.
Which is too late.

I found the possibility to call the Activate function
for all OLEObjects on the current Worksheet. The code
is simple an looks like this:

ActiveSheet.TextComboBox.value = "something"

For Each oleobj In ws.OLEObjects
oleobj.Activate
Next

This works fine for Excel 2000 and XP. But calling the
Activate function in Excel 97 causes an error:

"Die Activate-Methode des OLEObject-Objektes ist fehlerhaft."

in english, something like

"The activate Method of the OLEObject is faulty."

??? What? Why? I could not find a clue what this is supposed
to mean... I found references to an attribute TakeFocusOnClick
but I cannot find it in the OLEObject- or ComboBox-class.

Thanks for your help.

Peter Fopma