retrieve name of object user clicks on

R

Ruggles

I know how to use Screen.ActiveControl, but that doesn't seem to work
with the Rectangle object on a form. I want to be able to have say 50
rectangles on a form, and then retrieve the name of whichever one the
user clicks on. If there were 50 text boxes this would be easy:
Msgbox Screen.ActiveControl.name. But that doesn't work for the
Rectangle object. Is this possible?
 
Joined
Feb 9, 2012
Messages
25
Reaction score
0
I don't think this will be possible using rectangles as you can't click inside them just on the line. This might be better achieved using a label mdified to look like a rectangle. The Screen.ActiveControl code still won;t work but you could hard write it as follows:

Private Sub Label1_Click()
MsgBox (Me!Label1.Name)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top