Re ça c'est fait. c'est juste pour en ajouter une couche au niveau protection à+ M41
"LSteph" a écrit dans le message de news:
Bonjour,
Imagine qu'on te bloque l'accès à l'Editeur VBA..!
Protège plutôt ton projet.
Cordialement.
-- lSteph
Bonjour
Comment bloquer l'accès à l'éditeur VBA en utilisant VBA
Merci. Cordialement
M41
PMO
Bonjour,
Une piste avec le code suivant à copier dans ThisWorkbook
'*********************** Private Sub Workbook_Activate() On Error Resume Next Application.VBE.MainWindow.Visible = False Call SwitchVBE(False) End Sub
Private Sub Workbook_Deactivate() On Error Resume Next Application.VBE.MainWindow.Visible = True Call SwitchVBE(True) End Sub
Sub SwitchVBE(bool As Boolean) With Application If bool Then .OnKey "%{F8}" .OnKey "%{F11}" Else .OnKey "%{F8}", "" .OnKey "%{F11}", "" End If .CommandBars("Visual Basic").Enabled = bool .CommandBars("Macro").Enabled = bool End With End Sub '***********************
Cordialement.
PMO Patrick Morange
Bonjour,
Une piste avec le code suivant à copier
dans ThisWorkbook
'***********************
Private Sub Workbook_Activate()
On Error Resume Next
Application.VBE.MainWindow.Visible = False
Call SwitchVBE(False)
End Sub
Private Sub Workbook_Deactivate()
On Error Resume Next
Application.VBE.MainWindow.Visible = True
Call SwitchVBE(True)
End Sub
Sub SwitchVBE(bool As Boolean)
With Application
If bool Then
.OnKey "%{F8}"
.OnKey "%{F11}"
Else
.OnKey "%{F8}", ""
.OnKey "%{F11}", ""
End If
.CommandBars("Visual Basic").Enabled = bool
.CommandBars("Macro").Enabled = bool
End With
End Sub
'***********************
Une piste avec le code suivant à copier dans ThisWorkbook
'*********************** Private Sub Workbook_Activate() On Error Resume Next Application.VBE.MainWindow.Visible = False Call SwitchVBE(False) End Sub
Private Sub Workbook_Deactivate() On Error Resume Next Application.VBE.MainWindow.Visible = True Call SwitchVBE(True) End Sub
Sub SwitchVBE(bool As Boolean) With Application If bool Then .OnKey "%{F8}" .OnKey "%{F11}" Else .OnKey "%{F8}", "" .OnKey "%{F11}", "" End If .CommandBars("Visual Basic").Enabled = bool .CommandBars("Macro").Enabled = bool End With End Sub '***********************