OVH Cloud OVH Cloud

Barres d'outils toujours la!!

3 réponses
Avatar
Michel HOLDERITH
Bonjour tout le monde

j'ai dans mon workbook :

Private Sub Workbook_Open()
Application.ScreenUpdating = False
For P = 1 To Sheets.Count
Sheets(P).Visible = True
Sheets(P).Select
With ActiveWindow
.DisplayHeadings = False
.DisplayHorizontalScrollBar = False
End With
If ActiveSheet.Name = "Couverture" Then
Else
Sheets(P).Visible = False
End If
Next P
'barre outils
Sheets("StockBarOut").Visible = True
Sheets("StockBarOut").Select
With Application
.CommandBars(1).Enabled = False
.DisplayFormulaBar = False
.DisplayStatusBar = False
.DisplayFullScreen = True
End With
Sheets("StockBarOut").Range("A:A").ClearContents
TBarCompteur = 0
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypeNormal Then
If cbar.Visible Then
TBarCompteur = TBarCompteur + 1
Sheets("StockBarOut").Cells(TBarCompteur, 1) = cbar.Name
cbar.Visible = False
End If
End If
Next cbar
Sheets("StockBarOut").Visible = False
'fin barre outils

Application.ScreenUpdating = True

'desactivation clavier
Dim K, I As Integer
On Error Resume Next
For Each K In Array("^", "%", "+^", "+%", "^%", "+^%")
For I = 32 To 255
Application.OnKey K & Chr$(I), ""
Next I
Next K

'Sheets(1).Select

End Sub

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
Cancel = True
End Sub

cela normalement empeche l'utilisateur de faire un un click de droite, de
faire un copier/couper coller avec le racourcis clavier. ca ca marche....
L'autre chose je voudrais egalement empecher l'utilisateur d'acceder a tous
les menus de toutes les barres d'excel.
mais la ca ne marche pas trop bien....
une fois sur deux excel m'affiche la formula bar alors que je l'ai specifiee
a False. L'autre chose que je me suis appercu c'est que apres l'ouverture du
fichier si on double click tout en haut de la fenetre d'excel, cette fenetre
ce reduit puis on peu l'agrandire de nouveau et la ???? comme par magie on
retrouve les barres d'outils.....

Ma question : Comment eviter definitivement de retrouver ces barres d'outils
?

Merci d'avance pour vos reponses,
@+
Michel.

3 réponses

Avatar
Alain CROS
Bonjour.

Dans le ThisWorkbook.
Il te faudra prévoir dans ce fichier un moyen pour retourner sur les autres classeurs.

Sub GestionInterface(Optional etat As Boolean = True)
Static TblCb() As Boolean
Static TblEtat(1) As Boolean
Static NbCb As Integer
Dim Cb As Integer
Select Case etat
Case True 'bloquage
With Application
.ScreenUpdating = False
NbCb = .CommandBars.Count
ReDim TblCb(1 To NbCb)
For Cb = 1 To NbCb
With .CommandBars(Cb)
TblCb(Cb) = .Enabled
.Enabled = False
End With
Next Cb
TblEtat(0) = .DisplayFormulaBar
TblEtat(1) = .DisplayStatusBar
.DisplayFormulaBar = False
.DisplayStatusBar = False
End With
Case False 'debloquage
With Application
.ScreenUpdating = False
For Cb = 1 To NbCb
.CommandBars(Cb).Enabled = TblCb(Cb)
Next Cb
.DisplayFormulaBar = TblEtat(0)
.DisplayStatusBar = TblEtat(1)
End With
End Select
End Sub
Private Sub Workbook_Activate()
GestionInterface
End Sub
Private Sub Workbook_Deactivate()
GestionInterface False
End Sub

Alain CROS.
Avatar
Michel HOLDERITH
Merci... je desesperer d'avoir une reponse.....
Je test ca chez moi et je te reponds demain
@+
Michel.

"Alain CROS" wrote in message
news:
Bonjour.

Dans le ThisWorkbook.
Il te faudra prévoir dans ce fichier un moyen pour retourner sur les
autres classeurs.


Sub GestionInterface(Optional etat As Boolean = True)
Static TblCb() As Boolean
Static TblEtat(1) As Boolean
Static NbCb As Integer
Dim Cb As Integer
Select Case etat
Case True 'bloquage
With Application
.ScreenUpdating = False
NbCb = .CommandBars.Count
ReDim TblCb(1 To NbCb)
For Cb = 1 To NbCb
With .CommandBars(Cb)
TblCb(Cb) = .Enabled
.Enabled = False
End With
Next Cb
TblEtat(0) = .DisplayFormulaBar
TblEtat(1) = .DisplayStatusBar
.DisplayFormulaBar = False
.DisplayStatusBar = False
End With
Case False 'debloquage
With Application
.ScreenUpdating = False
For Cb = 1 To NbCb
.CommandBars(Cb).Enabled = TblCb(Cb)
Next Cb
.DisplayFormulaBar = TblEtat(0)
.DisplayStatusBar = TblEtat(1)
End With
End Select
End Sub
Private Sub Workbook_Activate()
GestionInterface
End Sub
Private Sub Workbook_Deactivate()
GestionInterface False
End Sub

Alain CROS.




Avatar
Michel HOLDERITH
Super un tres grand merci c'est pil ce qu'il me falait
@+
Michel.

"Alain CROS" wrote in message
news:
Bonjour.

Dans le ThisWorkbook.
Il te faudra prévoir dans ce fichier un moyen pour retourner sur les
autres classeurs.


Sub GestionInterface(Optional etat As Boolean = True)
Static TblCb() As Boolean
Static TblEtat(1) As Boolean
Static NbCb As Integer
Dim Cb As Integer
Select Case etat
Case True 'bloquage
With Application
.ScreenUpdating = False
NbCb = .CommandBars.Count
ReDim TblCb(1 To NbCb)
For Cb = 1 To NbCb
With .CommandBars(Cb)
TblCb(Cb) = .Enabled
.Enabled = False
End With
Next Cb
TblEtat(0) = .DisplayFormulaBar
TblEtat(1) = .DisplayStatusBar
.DisplayFormulaBar = False
.DisplayStatusBar = False
End With
Case False 'debloquage
With Application
.ScreenUpdating = False
For Cb = 1 To NbCb
.CommandBars(Cb).Enabled = TblCb(Cb)
Next Cb
.DisplayFormulaBar = TblEtat(0)
.DisplayStatusBar = TblEtat(1)
End With
End Select
End Sub
Private Sub Workbook_Activate()
GestionInterface
End Sub
Private Sub Workbook_Deactivate()
GestionInterface False
End Sub

Alain CROS.