AW: Aktion ausführen, wenn Mauszeiger auf Button zeigt
15.11.2006 14:36:26
fcs
Hallo Winfried,
könnte man dann etwa so lösen, dass die X-Y-Koordinaten der Maus auf dem Button überwacht werden. Die 5er-Werte kann man auch weglassen, allerdings ist dann die "Reaktionszone" sehr schmal und wenn man die Maus etwas schneller vom Button zieht wird das Makro nicht mehr ausgeführt.
Gruß
Franz
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim Bereich As Range
Set Bereich = Me.Range("E18:F23")
With Me.CommandButton1
If X > 5 And X < .Width - 5 And Y > 5 And Y < .Height - 5 Then
With Bereich
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 3
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 3
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 3
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = 3
End With
End With
Else
With Bereich
With .Borders(xlEdgeLeft)
.LineStyle = xlNone
End With
With .Borders(xlEdgeTop)
.LineStyle = xlNone
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlNone
End With
With .Borders(xlEdgeRight)
.LineStyle = xlNone
End With
End With
End If
End With
End Sub