View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Which activeX control currently has the focus?

Hi Peter

Thanks for the suggestion - I figured there wasn't a 'real' way to do
it :(

What about creating a global variable, and in the GotFocus/LostFocus
events I could save/clear the name of the current control. Is that
reasonable?


Optionally...

Public gcboActive As Object '//in a standard module

Then in the sheet code module:
Private Sub ComboBox1_GotFocus()
Set gcboActive = Me.ComboBox1
End Sub
Private Sub ComboBox1_LostFocus()
Set gcboActive = Nothing
End Sub

Then ref it in code like this...

Sub DoThis()
If gcboActive = Nothing Then Exit Sub
If gcboActive.Text = <string Then...
OR
If gcboActive.ListIndex = <number Then...
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion