ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Button Properties (https://www.excelbanter.com/excel-programming/271862-command-button-properties.html)

Darren O'Connell

Command Button Properties
 
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?

Harald Staff[_5_]

Command Button Properties
 
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

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"Darren O'Connell" skrev i melding ...
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?





All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com