bonjour,
En VBA EXCEL, quelle(s) instruction(s) permet de savoir si un raccourci clavier est affecté à une macro (sub) ?
j'ai trouvé cette macro, mais elle ne fonctionne pas dans excel 365 :
Sub ListeMacros()
Dim Macro As String, Racc As String
Dim Rpt As String, I As Integer
Application.ScreenUpdating = False
Workbooks.Add.Worksheets(1).[A1:B1] = [{"Procédure","Raccourci"}]
SendKeys "%{F8}%a{PGUP}{TAB}{ESC}"
'nécessite une référence à la bibliothèque
'Microsoft Forms 2.0 Object Library
With New DataObject
Do
Rpt = "%{F8}{TAB}" & Application.Rept("{DOWN}", I)
SendKeys Rpt & "%n^c{ESC}", True
.GetFromClipboard
If Macro = .GetText(1) Then Exit Do
Macro = .GetText(1)
SendKeys Rpt & "%t^c{ESC}{ESC}", True
.GetFromClipboard
Racc = .GetText(1)
I = I + 1
Cells(I + 1, 1) = Macro
If Racc <> Macro Then Cells(I + 1, 2) = "Ctrl-" & Racc
Loop
End With
With Columns("A:B")
.AutoFit
.Sort [A1], Header:=xlYes
.CurrentRegion.AutoFormat xlRangeAutoFormatColor2
End With
End Sub
Merci pour votre aide.
Bonne journée