Command Button Properties

D

Darren O'Connell

Hi there,

I have a command button on my worksheet that has a picture
rather than a caption. What do I need to do so that when
the mouse arrow settles on the button, the caption of the
command bar gets displayed?

Also I'm trying to match up the colours available on a
command button with the Fill Colour available on the Excel
tool bar and I can't get a match. I want Sky Blue but I
don't know the code.

Can you help?
 
H

Harald Staff

Hi

It's pretty awkward since the buttons don't have a "Mouse leave" or "Mouse exit" event. But see if this gets you started:

Private Sub CommandButton1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal X As Single, _
ByVal Y As Single)
With CommandButton1
Select Case X
Case 0 To 3
.Caption = ""
Case .Width - 3 To .Width
.Caption = ""
Case Else
Select Case Y
Case 0 To 3
.Caption = ""
Case .Height - 3 To .Height
.Caption = ""
Case Else
.Caption = "Yo"
End Select
End Select
End With
End Sub

As for colors, see Davids page http://www.mvps.org/dmcritchie/excel/colors.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top