Simply
XLDnaute Occasionnel
Bonjour
Je l'ai modifié le code avec des références à Ptrsafe in Excel 2016 64 Bit.
Il ne fonctionne pas correctement, demander de l'aide à comprendre comment corriger le code.
Dans un module:
J'espère votre aide
Je l'ai modifié le code avec des références à Ptrsafe in Excel 2016 64 Bit.
Il ne fonctionne pas correctement, demander de l'aide à comprendre comment corriger le code.
Dans un module:
Code:
Option Explicit
#If VBA7 And Win64 Then
Private Declare PtrSafe Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare PtrSafe Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Public Declare PtrSafe Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare PtrSafe Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
#Else
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
#End If
Public curCell As Range
Public Type POINTAPI
X As Long
Y As Long
End Type
Private CursorPos As POINTAPI
Private CursorCell As Range
Public bActive As Boolean
Sub Active()
On Error Resume Next
If bActive Then Exit Sub
SetTimer Application.hWnd, 1, 250, AddressOf RowAlternative
bActive = True
End Sub
Sub DeActive()
On Error Resume Next
bActive = False
KillTimer Application.hWnd, 1
ActiveSheet.Rows(curCell.Row).FormatConditions(1).Delete
End Sub
Private Function RowAlternative()
On Error Resume Next
Dim RetVal As Long
RetVal = GetCursorPos(CursorPos)
RetVal = WindowFromPoint(CursorPos.X, CursorPos.Y)
If (Application.Name <> "Microsoft Excel") Then Exit Function
Set CursorCell = Application.Windows(1).RangeFromPoint(CursorPos.X, CursorPos.Y)
If Err.Number = 0 Then
If CursorCell.Address <> curCell.Address Then
ActiveSheet.Rows(curCell.Row).FormatConditions(1).Delete
Set curCell = CursorCell
ActiveSheet.Rows(curCell.Row).FormatConditions.Add xlExpression, , "=true"
ActiveSheet.Rows(curCell.Row).FormatConditions(1).Interior.ColorIndex = 24
End If
End If
End Function
J'espère votre aide