OVH Cloud OVH Cloud

Enlever des fonctions excel pour un classeur donné ...

5 réponses
Avatar
kalinaja
Bonjour,

Je cherche à empêcher l'accès aux fonctions afficher masquer du menu excel
et clic droit,

J'ai trouvé le code suivant sur excelabo :

Private Sub
Workbook_Open()
Application.CommandBars(1).Enabled = False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(1).Enabled = True
End Sub

cela à l'air d'être exactement ce que je cherche ...mais ...
Savez vous ou je pêux trouver la référence exacte à passer en false qui
renvoie aux commandes afficher masquer ?

En vous remerciant,

FF

5 réponses

Avatar
F
Lance l'enregistreur et lance la procédure "manuellement" puis récupère
le code qui t'intéresse.
J'utile souvent cette méthode.
En espérant t'avoir mis sur la voie ;o)

kalinaja a écrit:
Bonjour,

Je cherche à empêcher l'accès aux fonctions afficher masquer du menu excel
et clic droit,

J'ai trouvé le code suivant sur excelabo :

Private Sub
Workbook_Open()
Application.CommandBars(1).Enabled = False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(1).Enabled = True
End Sub

cela à l'air d'être exactement ce que je cherche ...mais ...
Savez vous ou je pêux trouver la référence exacte à passer en false qui
renvoie aux commandes afficher masquer ?

En vous remerciant,

FF


Avatar
kalinaja
merci !
euh et bien à vrai dire je n'arrive pas à y accéder manuellement alors ...je
sèche ...
mais ne désespère pas ... ;+)





"" wrote:

Lance l'enregistreur et lance la procédure "manuellement" puis récupère
le code qui t'intéresse.
J'utile souvent cette méthode.
En espérant t'avoir mis sur la voie ;o)

kalinaja a écrit:
Bonjour,

Je cherche à empêcher l'accès aux fonctions afficher masquer du menu excel
et clic droit,

J'ai trouvé le code suivant sur excelabo :

Private Sub
Workbook_Open()
Application.CommandBars(1).Enabled = False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(1).Enabled = True
End Sub

cela à l'air d'être exactement ce que je cherche ...mais ...
Savez vous ou je pêux trouver la référence exacte à passer en false qui
renvoie aux commandes afficher masquer ?

En vous remerciant,

FF






Avatar
papou
Bonjour
Il y a deux menus qui proposent Afficher Masquer, à toi de choisir :
1°) Format Feuille
CommandBars.FindControl(, 891).Enabled = False 'Afficher
CommandBars.FindControl(, 890).Enabled = False 'Masquer

2°) Fenêtre
CommandBars.FindControl(, 866).Enabled = False 'Afficher
CommandBars.FindControl(, 865).Enabled = False 'Masquer

Cordialement
Pascal

"kalinaja" a écrit dans le message de
news:
Bonjour,

Je cherche à empêcher l'accès aux fonctions afficher masquer du menu excel
et clic droit,

J'ai trouvé le code suivant sur excelabo :

Private Sub
Workbook_Open()
Application.CommandBars(1).Enabled = False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(1).Enabled = True
End Sub

cela à l'air d'être exactement ce que je cherche ...mais ...
Savez vous ou je pêux trouver la référence exacte à passer en false qui
renvoie aux commandes afficher masquer ?

En vous remerciant,

FF


Avatar
ChrisV
Bonjour kalinaja,

Dans la feuille de code de ThisWorkbook...
(pour Excel 2003)

Private Sub Workbook_Activate()
With Application
.CommandBars(1).Controls(5) _
.Controls(2).Controls(3).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(2).Controls(4).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(3).Controls(3).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(3).Controls(4).Enabled = False
.CommandBars("Toolbar List").Enabled = False
End With
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypePopup Then
cbar.Enabled = False
End If
Next cbar
End Sub

Private Sub Workbook_Deactivate()
With Application
.CommandBars(1).Controls(5) _
.Controls(2).Controls(3).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(2).Controls(4).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(3).Controls(3).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(3).Controls(4).Enabled = False
.CommandBars("Toolbar List").Enabled = False
End With
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypePopup Then
cbar.Enabled = False
End If
Next cbar
End Sub


ChrisV


"kalinaja" a écrit dans le message de
news:
Bonjour,

Je cherche à empêcher l'accès aux fonctions afficher masquer du menu excel
et clic droit,

J'ai trouvé le code suivant sur excelabo :

Private Sub
Workbook_Open()
Application.CommandBars(1).Enabled = False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(1).Enabled = True
End Sub

cela à l'air d'être exactement ce que je cherche ...mais ...
Savez vous ou je pêux trouver la référence exacte à passer en false qui
renvoie aux commandes afficher masquer ?

En vous remerciant,

FF


Avatar
ChrisV
Bonjour kalinaja,

Dans la feuille de code de ThisWorkbook...
(pour Excel 2003)

Private Sub Workbook_Activate()
With Application
.CommandBars(1).Controls(5) _
.Controls(2).Controls(3).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(2).Controls(4).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(3).Controls(3).Enabled = False
.CommandBars(1).Controls(5) _
.Controls(3).Controls(4).Enabled = False
.CommandBars("Toolbar List").Enabled = False
End With
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypePopup Then
cbar.Enabled = False
End If
Next cbar
End Sub

Private Sub Workbook_Deactivate()
With Application
.CommandBars(1).Controls(5) _
.Controls(2).Controls(3).Enabled = True
.CommandBars(1).Controls(5) _
.Controls(2).Controls(4).Enabled = True
.CommandBars(1).Controls(5) _
.Controls(3).Controls(3).Enabled = True
.CommandBars(1).Controls(5) _
.Controls(3).Controls(4).Enabled = True
.CommandBars("Toolbar List").Enabled = True
End With
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypePopup Then
cbar.Enabled = True
End If
Next cbar
End Sub


ChrisV


"kalinaja" a écrit dans le message de
news:
Bonjour,

Je cherche à empêcher l'accès aux fonctions afficher masquer du menu excel
et clic droit,

J'ai trouvé le code suivant sur excelabo :

Private Sub
Workbook_Open()
Application.CommandBars(1).Enabled = False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars(1).Enabled = True
End Sub

cela à l'air d'être exactement ce que je cherche ...mais ...
Savez vous ou je pêux trouver la référence exacte à passer en false qui
renvoie aux commandes afficher masquer ?

En vous remerciant,

FF