Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Anzeige
Inhaltsverzeichnis

Oberes Banner ausblenden

Forumthread: Oberes Banner ausblenden

Oberes Banner ausblenden
14.01.2026 15:40:43
Jörg
Ich habe noch eine letzte kleine Frage.
Vielleicht klinkt es komisch.
Ist es möglich in Excel das obere Banner auch auszublenden?
Ich meine das wo das Kreuz, minimieren und dropdown sind.

MFG
Anzeige

15
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Oberes Banner ausblenden
14.01.2026 20:06:20
volti
Hallo Jörg,

schau mal ob's bei Dir funktioniert und das ist was Du möchstest...

#If Win64 Then

Private Declare PtrSafe Function GetWindowLongA Lib "user32" Alias "GetWindowLongPtrA" ( _
ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" Alias "SetWindowLongPtrA" ( _
ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare PtrSafe Function GetWindowLongA Lib "user32" ( _
ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" ( _
ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#End If
Private Const GWL_STYLE As Long = (-16)
Private Const WS_SYSMENU As Long = &H80000
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_MAXIMINIMIZEBOX As Long = &H30000

Private Sub AusEin(ByVal bWie As Boolean)
Dim hStil As LongPtr

ThisWorkbook.Application.DisplayFullScreen = bWie
hStil = GetWindowLongA(Application.hwnd, GWL_STYLE)
hStil = IIf(bWie, hStil And Not WS_SYSMENU, hStil Or WS_SYSMENU)
hStil = IIf(bWie, hStil And Not WS_MAXIMINIMIZEBOX, hStil Or WS_MAXIMINIMIZEBOX)
hStil = IIf(bWie, hStil And Not WS_CAPTION, hStil Or WS_CAPTION)
SetWindowLongA Application.hwnd, GWL_STYLE, hStil
End Sub

Public Sub Aus()
Call AusEin(True)
End Sub

Public Sub Ein()
Call AusEin(False)
End Sub


Gruß
Karl-Heinz
Anzeige
AW: Oberes Banner ausblenden
14.01.2026 20:21:46
volti
Hallo,

ein Update, falls der vorherige code unzuverlässig sein sollte.

Private Declare PtrSafe Function GetWindowRect Lib "user32" ( _

ByVal hWnd As LongPtr, lpRect As RECT) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal hWndInsertAfter As LongPtr, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
#If Win64 Then
Private Declare PtrSafe Function GetWindowLongA Lib "user32" Alias "GetWindowLongPtrA" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" Alias "SetWindowLongPtrA" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare PtrSafe Function GetWindowLongA Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#End If

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Const GWL_STYLE As Long = (-16)
Private Const WS_SYSMENU As Long = &H80000
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_MAXIMINIMIZEBOX As Long = &H30000
Private Const SWP_FRAMECHANGED As Long = &H20
Private Const SWP_NOREPOSITION As Long = &H200
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_NOZORDER As Long = &H4

Private Sub AusEin(ByVal bWie As Boolean)
Dim hWnd As LongPtr, hStil As LongPtr, R As RECT

hWnd = Application.hWnd
GetWindowRect hWnd, R
ThisWorkbook.Application.DisplayFullScreen = bWie
hStil = GetWindowLongA(hWnd, GWL_STYLE)
hStil = IIf(bWie, hStil And Not WS_SYSMENU, hStil Or WS_SYSMENU)
hStil = IIf(bWie, hStil And Not WS_MAXIMINIMIZEBOX, hStil Or WS_MAXIMINIMIZEBOX)
hStil = IIf(bWie, hStil And Not WS_CAPTION, hStil Or WS_CAPTION)
SetWindowLongA hWnd, GWL_STYLE, hStil
SetWindowPos hWnd, 0, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, _
SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED
End Sub

Public Sub Aus()
Call AusEin(True)
End Sub

Public Sub Ein()
Call AusEin(False)
End Sub


Gruß
KH
Anzeige
AW: Oberes Banner ausblenden
14.01.2026 20:23:01
Jörg
Vielen Dank. Werde es morgen probieren 😊
AW: Oberes Banner ausblenden
14.01.2026 20:49:55
volti
Last not least.

Noch etwas kürzer.

Private Declare PtrSafe Function GetWindowRect Lib "user32" ( _

ByVal hWnd As LongPtr, lpRect As RECT) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal hWndInsertAfter As LongPtr, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
#If Win64 Then
Private Declare PtrSafe Function GetWindowLongA Lib "user32" Alias "GetWindowLongPtrA" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" Alias "SetWindowLongPtrA" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare PtrSafe Function GetWindowLongA Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#End If

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Const GWL_STYLE As Long = (-16)
Private Const SWP_MYSTYLE As Long = &H224 ' SWP_NOZORDER + SWP_FRAMECHANGED + SWP_NOREPOSITION
Private Const WS_MYSTYLE As Long = &HCB0000 ' WS_CAPTION + WS_SYSMENU + WS_MAXIMINIMIZEBOX

Private Sub AusEin(ByVal bWie As Boolean)
Dim hStil As LongPtr, R As RECT

With Application
GetWindowRect .hWnd, R
ThisWorkbook.Application.DisplayFullScreen = bWie
hStil = GetWindowLongA(.hWnd, GWL_STYLE)
SetWindowLongA .hWnd, GWL_STYLE, IIf(bWie, hStil And Not WS_MYSTYLE, hStil Or WS_MYSTYLE)
SetWindowPos .hWnd, 0, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, SWP_MYSTYLE
End With
End Sub

Public Sub Aus()
Call AusEin(True)
End Sub

Public Sub Ein()
Call AusEin(False)
End Sub


Gruß KH
Anzeige
AW: Oberes Banner ausblenden
15.01.2026 13:12:24
Jörg
Hallo KH
vielen Dank für die Hilfe.

Soweit funktioniert es, wie ich es wollte.
Leider bleibt die Leiste für die Eingaben vorhanden.
Ich hatte mir schon vorher einige kleine Macros geschrieben, wo ich alles ausblenden kann. Nur das Banner bzw Titelleiste nicht.
Ich bräuchte nur noch für das Banner (Titelleiste) die Funktionen an und aus, dann wäre meine Tabelle perfekt
Hier mal meine Codes

Sub Statusleiste_ausblenden()
Application.DisplayStatusBar = False
End Sub
Sub leiste_ausblenden()
ActiveWindow.DisplayWorkbookTabs = False
End Sub
Sub Zeilennummer_ausblenden()
ActiveWindow.DisplayHeadings = False
End Sub
Sub Zeilennummer_einblenden()
ActiveWindow.DisplayHeadings = True
End Sub
Sub Statusleiste_einblenden()
Application.DisplayStatusBar = True
End Sub
Sub leiste_einblenden()
ActiveWindow.DisplayWorkbookTabs = True
End Sub
Sub Überschriften()
Application.DisplayFormulaBar = False
End Sub
Sub MenüAus()
Application.ExecuteExcel4Macro "Show.Toolbar(""Ribbon"", False)"
End Sub
Sub BildlaufBlende()
With ActiveWindow
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
End With
End Sub
Sub BildlaufEin()
With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
End With
End Sub
Sub Workbook_Deactivate()
Application.ExecuteExcel4Macro "Show.Toolbar(""Ribbon"", True)"
End Sub
Sub Überschriften_ein()
Application.DisplayFormulaBar = True
End Sub
Jetzt fehlt mir nur noch das mit dem Banner, was du ja schon so gut erstellt hast.
Geht das noch anders?
Noch mal vielen Dank für deine Unterstützung
Grüße
Jörg
Anzeige
AW: Oberes Banner ausblenden
15.01.2026 14:30:50
volti
Hallo Jörg,

hast Du einen speziellen Grund, weshalb Du für jede Aktion eine eigene Sub verwendest?

Das Ausschalten der Titelleiste (Caption) hängt hier bei Excel auch mit dem Status der Menueleiste usw. zusammen, daher sind zwei Extra-Subs hierfür m.E. nicht empfehlenswert.

Ich habe Dir im u.a. Code daher alles in eine Sub AusEin1 gepackt, die sowohl das Ein- wie auch das Ausschalten anhand des übergebenen Werts handelt.
Hier wird zum Menübandausschalten das bereits empfohlene ExecuteExcel4Macro, ein immer noch funktionierendes Relikt aus Zeiten vor Excel5, verwendet.

In der Sub AusEin2 habe ich anstelle dessen alternativ den Befehl DisplayFullScreen verwendet.

Option Explicit


Private Declare PtrSafe Function GetWindowRect Lib "user32" ( _
ByVal hWnd As LongPtr, lpRect As RECT) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal hWndInsertAfter As LongPtr, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
#If Win64 Then
Private Declare PtrSafe Function GetWindowLongA Lib "user32" Alias "GetWindowLongPtrA" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" Alias "SetWindowLongPtrA" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare PtrSafe Function GetWindowLongA Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
#End If

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Const GWL_STYLE As Long = (-16)
Private Const SWP_MYSTYLE As Long = &H224 ' SWP_NOZORDER + SWP_FRAMECHANGED + SWP_NOREPOSITION
Private Const WS_MYSTYLE As Long = &HCB0000 ' WS_CAPTION + WS_SYSMENU + WS_MAXIMINIMIZEBOX

Private Sub AusEin1(ByVal bWie As Boolean)
Dim hStil As LongPtr, R As RECT

With Application
GetWindowRect .hWnd, R
If bWie Then
.ExecuteExcel4Macro "Show.Toolbar(""Ribbon"", true)"
Else
.ExecuteExcel4Macro "Show.Toolbar(""Ribbon"", false)"
End If
.DisplayStatusBar = bWie ' Statusbar ein/aus
.DisplayFormulaBar = bWie ' Eingabefeld ein/aus
With ActiveWindow
.DisplayWorkbookTabs = bWie ' Register ein/aus
.DisplayHeadings = bWie ' Zeilen/Spaltenbezeichnungen ein/aus
.DisplayHorizontalScrollBar = bWie ' Scrollleiste ein/aus
.DisplayVerticalScrollBar = bWie ' Scrollleiste ein/aus
End With
hStil = GetWindowLongA(.hWnd, GWL_STYLE)
SetWindowLongA .hWnd, GWL_STYLE, IIf(bWie, hStil Or WS_MYSTYLE, hStil And Not WS_MYSTYLE)
SetWindowPos .hWnd, 0, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, SWP_MYSTYLE
End With
End Sub

Public Sub Aus()
Call AusEin1(False)
End Sub

Public Sub Ein()
Call AusEin1(True)
End Sub

Private Sub AusEin2(ByVal bWie As Boolean)
' Alternative mit gleichen Funktionen
Dim hStil As LongPtr, R As RECT

With Application
GetWindowRect .hWnd, R
.DisplayFullScreen = Not bWie ' Vollbild ein/aus
.DisplayStatusBar = bWie ' Statusbar ein/aus
.DisplayFormulaBar = bWie ' Eingabefeld ein/aus
With ActiveWindow
.DisplayWorkbookTabs = bWie ' Register ein/aus
.DisplayHeadings = bWie ' Zeilen/Spaltenbezeichnungen ein/aus
.DisplayHorizontalScrollBar = bWie ' Scrollleiste ein/aus
.DisplayVerticalScrollBar = bWie ' Scrollleiste ein/aus
End With
hStil = GetWindowLongA(.hWnd, GWL_STYLE)
SetWindowLongA .hWnd, GWL_STYLE, IIf(bWie, hStil Or WS_MYSTYLE, hStil And Not WS_MYSTYLE)
SetWindowPos .hWnd, 0, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, SWP_MYSTYLE
End With
End Sub


Gruß
KH
Anzeige
AW: Oberes Banner ausblenden
15.01.2026 15:17:01
Jörg
Ich möchte mich recht herzlich bei dir bedanken.
Du hast dir soviel Mühe gemacht.
Ich werde es nachher gleich ausprobieren.
Mit meinen Abschaltungen, ich habe mal vor sehr langer Zeit was in Excel gemacht. Da habe ich einfach diese Macros übernommen.
Super wenn es besser geht.

Vielen Dank noch mal
Anzeige
AW: Oberes Banner ausblenden
15.01.2026 17:45:44
Jörg
Hallo KH,

vielen vielen Dank, jetzt funktioniert es wie ich es mir vorgestellt habe.
Danke noch einmal

LG
Jörg
AW: Oberes Banner ausblenden
15.01.2026 15:20:17
Jörg
Eine sehr kleine Frage habe ich da doch noch.

Gibt es eine Funktion alle Macros zu deaktivieren, ohne über Option/Einstellung/Trust
zugehen?

Grüße Jörg
Anzeige
AW: Oberes Banner ausblenden
15.01.2026 15:22:06
volti
Um hier sicher zu gehen, nimm doch eine xlsx-Datei.

Gruß
KH
AW: Oberes Banner ausblenden
15.01.2026 15:35:12
Jörg
Ich möchte nur manchmal die Macros deaktivieren, wenn ich etwas an den Tabellen ändern will oder neue hinzufügen will.
Was bedeutet das xlsx Format?

Grüße Jörg
AW: Oberes Banner ausblenden
15.01.2026 15:44:47
volti
Das XLSX-Format ist das gängige Excelformat, in dem keine Makros enthalten sein können. (gezippte xml)
Das XLSM-Format ist das gängige Excelformat, im dem Makros erlaubt sind. (gezippte xml)
Das XLSB-Format ein binäres Excelformat, das weitgehend dem alten XLS-Format entspricht. (Binärdaten)

Mir fällt zur Deaktivierung nur das Trustcenter ein.

Gruß
KH
Anzeige
AW: Oberes Banner ausblenden
15.01.2026 15:50:29
Jörg
Danke sehr,
Manchmal ist man einfach vernagelt. War ja klar mit den Formaten. Sonst hätte ich ja meine nicht mit Macros speichern können.
Danke das du mir trotzdem geschrieben hast
🤦😂🤣

Liebe Grüße
Jörg
@Armin
14.01.2026 18:33:07
RPP63
Moin Armin!
Fändest Du es nicht besser, einfach den Code zu posten?
Schließlich könnten Änderungen an der GUI manch unbedarften Neugierigen in eine Falle locken, aus der er ohne Hilfe nicht herauskommt.
Ich poste mal Deinen Code.
Private Sub Workbook_Open()

Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub


Dass der rein gar nichts mit dem Wunsch des TE gemein hat, ist Dir klar?
»Ist es möglich in Excel das obere Banner auch auszublenden?
Ich meine das wo das Kreuz, minimieren und dropdown sind.«


Gruß Ralf
Anzeige
Anzeige
Anzeige
Live-Forum - Die aktuellen Beiträge
Datum
Titel
14.05.2026 13:31:09
14.05.2026 09:50:42
13.05.2026 19:14:18