View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Passing a Label object to another procedure

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

"derobin" wrote in message
oups.com...
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