View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary L Brown Gary L Brown is offline
external usenet poster
 
Posts: 219
Default Retriving name of cobntrolelement

If it's on a form.

Call NewSub(Me.ActiveControl.name)

hth,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Jan Kronsell" wrote:

I have to pass the name of a controlelement as argument to a sub.But how do
i retrive the name of the control element. within the elements Click-event.
What I like is something like this:

Private Sub CheckBox0_Click()
Call NewSub("ActiveControl")
End Sub

In this case, the name of the active control is Checkbox(0), and the problem
could be solved using:

Private Sub CheckBox0_Click()
Call NewSub("Checkbox(0)")
End Sub

but I would like to be able to use the same code fro a lot of
controlelements, without having to hardcode all the names.

Regards
Jan