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

Hi,

I have a UserForm wich contains 20 Labels that should react to the Click
event. All those Labels have the special effect "Raised". When the user
clicks on one of them, it sinks like a button "Sunken". This works fine but
what I want is that when the user clicks on another Label, the previous one
returns to its original state (Raised) while the actuel Label sinks
"Sunken".

First I wrote some code for each of the Labels to obtain the desired effect:

In the UserForm module:

Public MyObject As Control

Private Sub LabelA1_Click() 'For each Label (20 times)
Set MyObject = LabelA1
Call SinkLabel
End Sub

Then a procedure to go from "Raised" to "Sunken":

Public Sub SinkLabel()
Static PrevObject As Control

If MyObject.SpecialEffect = fmSpecialEffectSunken Then Exit Sub

MyObject.SpecialEffect = fmSpecialEffectSunken

If PrevObject Is Nothing Then
'Do nothing
Else
PrevObject.SpecialEffect = fmSpecialEffectRaised
End If
Set PrevObject = MyObject

End Sub


Now I want to use a class module to acheive the same goal, But it works only
for the Label on wich the users clicks. It looks like it's impossible to get
the previous Label regain the "Raised" state.


If someone has an idea... Thank you very much.

Pierre


 
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 12:00 AM.

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"