AW: Probleme mit .DisplayFormuleBar
01.06.2010 22:54:52
Dieterlem
Hi Boris,
ich habe gehofft, dass das Problem vielleicht bekannt ist. Mein Code ist etwas umfangreicher daher werde ich mich auf die relevanten Dinge beschränken:
DieseArbeitsmappe:
Private Sub Workbook_Open()
Call Symbolleisten_verbergen
Call Symbolleiste_erzeugen
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayFormulaBar = True
End Sub
Private Sub Workbook_Activate()
Call Symbolleisten_verbergen
End Sub
Private Sub Workbook_Deactivate()
Call Symbolleisten_zeigen
Application.DisplayFormulaBar = True
End Sub
Modul1:
Sub Symbolleisten_zeigen()
'===============================================
' Alle Symbolleisten zeigen
'===============================================
Dim cmb As CommandBar
Dim i_Tab As Byte
Dim Tabold As Byte
On Error Resume Next
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
For Each cmb In .CommandBars
cmb.Enabled = True
Next cmb
On Error Resume Next ' Falls sie schon eingeblendet ist erscheint keine Fehlermeldung
.CommandBars("Personal").Enabled = True
.DisplayStatusBar = True 'Statusleiste (unten)
.DisplayFormulaBar = True 'Bearbeitungsleiste
.StatusBar = False 'StatusBar zurücksetzen u Excel übergeben
End With
With ActiveWindow
.DisplayHorizontalScrollBar = True 'Horizontale Bildlaufleiste
.DisplayVerticalScrollBar = True 'Vertikale Bildlaufleiste
.DisplayWorkbookTabs = True 'Arbeitsmappe Registerkarte
Tabold = ActiveSheet.Index
For i_Tab = 1 To Worksheets.Count
Sheets(i_Tab).Activate
.DisplayHeadings = True 'Zeilenbeschriftung A1;A2;A3;A4... False = ausblenden
Next i_Tab
Sheets(Tabold).Activate
End With
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
.
Sub Symbolleisten_verbergen()
'===============================================
' Alle Symbolleisten verbergen
'===============================================
Dim cmb As CommandBar
Dim i_Tab As Byte
Dim Tabold As Byte
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
'erst mal alle ausblenden, Personal inklusive
For Each cmb In .CommandBars
cmb.Enabled = False
Next cmb
On Error Resume Next
.CommandBars("Personal").Enabled = True 'wieder einblenden
.DisplayStatusBar = True
.DisplayFormulaBar = False
.StatusBar = False
ActiveWindow.DisplayWorkbookTabs = False 'Registerkarten
Tabold = ActiveSheet.Index
For i_Tab = 1 To Worksheets.Count
Sheets(i_Tab).Activate
ActiveWindow.DisplayHeadings = False 'Überschriften
Next i_Tab
Sheets(Tabold).Activate
.EnableEvents = True
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
.
Sub schliessen()
Dim Antw As Integer
Antw = MsgBox("Wollen Sie die Änderungen speichern?", vbYesNoCancel, "Speichern...")
If Antw = 6 Then
ThisWorkbook.Close SaveChanges:=True
ElseIf Antw = 7 Then
Application.DisplayFormulaBar = True
ThisWorkbook.Close SaveChanges:=False
Else
Exit Sub
End If
End Sub
Gruß
Dieterlem