durch einen Rechnerwechsel wurde bei uns von EXCEL 2010 auf EXCEL 2016 gewechselt.
Mein Programm musste ich teilweise anpassen, damit es läuft.
Nun stehe ich noch vor der Schwierigkeit, das ich die 3 oberen rechten Schaltflächen
(Minimieren, Bildgröße und Schließen) nicht mehr ausblenden kann
(siehe Bild https://www.herber.de/bbs/user/124076.jpg)
In Excel 2010 hat nachfolgender Code immer spitzenmäßig funktioniert.
Warum funktioniert er unter EXCEL 2016 nicht mehr? Wer kann mir helfen,
damit ich die 3 Schaltflächen ausgeblendet bekomme.
Hier der Code:
Option Explicit
'Variablen für Ausblenden Kreuz
Public Const GWL_STYLE = (-16), WS_SYSMENU = &H80000
#If VBA7 Then
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassname As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
#Else
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassname As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
#End If
Public Sub Beenden_Kreuz_Ausblenden()
Dim XL_Hwnd, LStyle
XL_Hwnd = FindWindow("xlMain", vbNullString)
If XL_Hwnd 0 Then
LStyle = GetWindowLong(XL_Hwnd, GWL_STYLE)
LStyle = SetWindowLong(XL_Hwnd, GWL_STYLE, LStyle And Not WS_SYSMENU)
DrawMenuBar XL_Hwnd
End If
End Sub
Public Sub Beenden_Kreuz_Einblenden()
Dim XL_Hwnd, LStyle
XL_Hwnd = FindWindow("xlMain", vbNullString)
If XL_Hwnd 0 Then
LStyle = GetWindowLong(XL_Hwnd, GWL_STYLE)
LStyle = SetWindowLong(XL_Hwnd, GWL_STYLE, LStyle Or WS_SYSMENU)
DrawMenuBar XL_Hwnd
End If
End Sub
Ich hoffe, mir kann einen von euch den entscheidenen Tipp geben, warum es nicht funktioniert und wie des richtig sein muss, damit die 3 Schaltflächen ausgeblendetwerden.
Grüße aus der Lausitz
Thomas