OVH Cloud OVH Cloud

Modification Shift Open sous Excel

1 réponse
Avatar
Isabelle
Bonjour,

Est-il possible en VBA Excel de pouvoir modifier :
le standard
Shift + Bouton Open -----> qui donne Save as
par
Shift + Bouton Open -----> qui donnerait Open
Par avance Merci beaucoup

Isabelle

1 réponse

Avatar
michdenis
Bonjour Isabelle,

Dans le ThisWorkbook de ton classeur :

Le nouveau raccourci clavier pour le bouton de commande Open de la barre d'outils "Standard" va être effectif seulement
après l'exécution de la procédure " Private Sub Workbook_Open() "


'-------------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
RéaffectationNormale_RaccourciClavier
End Sub
'-------------------------
Private Sub Workbook_Open()
ModifierRaccourciClavier
End Sub
'-------------------------

Tout ce qui suit dans un module Standard

'Dans le haut d'un module Standard : Déclaration de l'API
Public Declare Function GetKeyState _
Lib "user32" (ByVal nVirtKey As Long) As Integer

Public Const VK_LSHIFT = &HA0

'----------------------------
Sub ModifierRaccourciClavier()

For Each c In Application.CommandBars.FindControls(ID:#)
c.OnAction = "NouveauRaccourci"
Next

End Sub
'----------------------------
Sub NouveauRaccourci()

If GetKeyState(VK_LSHIFT) < 0 Then
Application.Dialogs(xlDialogOpen).Show
Else
Application.Dialogs(xlDialogSaveAs).Show
End If

End Sub
'----------------------------
Sub RéaffectationNormale_RaccourciClavier()

For Each c In Application.CommandBars.FindControls(ID:#)
c.OnAction = ""
Next

End Sub
'----------------------------


Salutations!



"Isabelle" a écrit dans le message de
news:1c85401c452a4$df3a7180$
Bonjour,

Est-il possible en VBA Excel de pouvoir modifier :
le standard
Shift + Bouton Open -----> qui donne Save as
par
Shift + Bouton Open -----> qui donnerait Open
Par avance Merci beaucoup

Isabelle