LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default To access a previous object via class module


Hello Pierre,

You didn't follow my directions. The UserForm code is to be placed in
the General Declarations section of the UserForm not in a standard VBA
module. This is the area above all the event (or as you refer to class)
code for the UserForm. Then place the following line in each of the
Label's MouseDown event code section. The default is the Click event.
Go to the top of the code area and click on the top right Drop Down
box. In the list you will see MouseDown listed. Click on it and then
type the following code...

Example for Label1:

Private Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Call ToggleLabel(Label1)
End Sub

Repeat this for each label you use. Besure to change the Label name in
the function to match the label it will modify.

Place this code in the General Declarations section of the UserForm:

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

Public Sub ToggleLabel(ByVal Lbl As MSForms.Label)

Dim ThisLabel As String

Lbl.SpecialEffect = fmSpecialEffectSunken
ThisLabel = Lbl.Name

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

LastLabel = ThisLabel

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
How to access group buttons in Class Module? Myles[_9_] Excel Programming 7 December 10th 05 02:37 PM
Reference Class Module in Access from Excel [email protected] Excel Programming 2 September 28th 05 09:55 AM
Class module in VBA romkeys Excel Programming 1 August 19th 04 06:20 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"