View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default Highlight Button...

The only way you can do this to my knowledge is to use
controls from the Control Tollbox toolbar and exploit the
MouseMove event supported by these controls. Suggested is
that you initially add one label from this toolbar and do
the following:

1) Right-click the label.
2) Select Properties from the popup menu.
3) Format the TextAlign property to fmTextAlignCenter.
4) Format the ForeColor property to whatever you like.
5) Change the Caption to whatever's appropriate.
(Note: Don't worry about the special effect propery - the
appended code will take care of this).
6) Close the Properties menu and right-click the label
again.
7) Select Copy.
8) Paste two copies of the label to the worksheet.
9) Go back into the Properties menu and change the
captions of these new labels to whatever you want.
10) Position the labels as required.
11) Unselect the Design Mode control at the top-left
corner of the Control Toolbox toolbar and close the
toolbar.
12) Paste the below code to the worksheet code module.


Private Sub Label1_MouseMove(ByVal Button As Integer,
ByVal Shift As Integer, ByVal X As Single, ByVal Y As
Single)
Normalize
Label1.BackColor = 16777164
Label1.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub Label2_MouseMove(ByVal Button As Integer,
ByVal Shift As Integer, ByVal X As Single, ByVal Y As
Single)
Normalize
Label2.BackColor = 16777164
Label2.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub Label3_MouseMove(ByVal Button As Integer,
ByVal Shift As Integer, ByVal X As Single, ByVal Y As
Single)
Normalize
Label3.BackColor = 16777164
Label3.SpecialEffect = fmSpecialEffectSunken
'Do whatever else . . .
End Sub
Private Sub Normalize()
Dim i As Long, OleObj As OLEObject
For i = 1 To 3
Set OleObj = Me.OLEObjects("Label" & i)
With OleObj.Object
.SpecialEffect = fmSpecialEffectRaised
.BackColor = vbMenuBar
End With
Next
End Sub

Regards,
Greg


-----Original Message-----
I created a database in Excel and attached buttons to

control macros. No
problem. I'd like to add code that will change the

appearance of the buttons
from raised to sunken when the cursor/pointer moves over

them, like in html
app's.

What code can I add to do this, and where should it go

(standard module,
etc...).

I always stress function over form, however, this tool is

going to senior
management so I want to make it look as "professional" as

possible.

Thanks for your help.

EU
.