View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_442_] Leith Ross[_442_] is offline
external usenet poster
 
Posts: 1
Default To access a previous object via class module


Hello Pierre,

Add the following code to the General declarations section of your user
form. Add the following call to each Label's MouseDown event code...

EXAMPLE:
Private Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)

Call ToggleState("Label1")

End Sub
______________________________

USERFORM CODE:

Code:
--------------------

Public LastLabel As String

Public Sub ToggleState(ByVal Label_Name As String)

Dim Label As Label

Set Lbl = Controls(Label_Name)

Lbl.SpecialEffect = fmSpecialEffectSunken

If LastLabel < "" Then
Set Lbl = Controls(LastLabel)
Lbl.SpecialEffect = fmSpecialEffectRaised
End If

LastLabel = Label_Name

End Sub

--------------------

_____________________________

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=496994