Passing a Label object to another procedure

  • Thread starter Thread starter derobin
  • Start date Start date
D

derobin

Hi,

on my form I have to set captions of several labels when they are
clicked. I want to do that in a stand-alone procedure but I can't
figure our how to pass the label which was clicked from the
Label1_Click procedure to the SetTheLabelsCaptionHere procedure.
I don't want to do it with a function: The labels caption should be set
in the SetTheLabelsCaptionHere procedure.

Thank You

Robin
 
Robin,
Private Sub Label1_Click()
MsgBox LabelClicked(Label1)
End Sub

Private Sub Label2_Click()
MsgBox LabelClicked(Label2)
End Sub

Private Function LabelClicked(argLabel As MSForms.Label) As String
LabelClicked = argLabel.Caption
End Function

NickHK
 

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

Back
Top