ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Passing a Label object to another procedure (https://www.excelbanter.com/excel-programming/370512-passing-label-object-another-procedure.html)

derobin

Passing a Label object to another procedure
 
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


NickHK

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





All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com