AW: UF öffnet/schließt zu langsam
21.07.2022 13:05:28
Nepumuk
Hallo Fred,
im Modul deines UserForms:
Option Explicit
Option Compare Text
#If Win64 Then
Private Declare PtrSafe Function GetWindowLongPtr Lib "user32.dll" Alias "GetWindowLongPtrA" ( _
ByVal hwnd As LongPtr, _
ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32.dll" Alias "SetWindowLongPtrA" ( _
ByVal hwnd As LongPtr, _
ByVal nIndex As Long, _
ByVal dwNewLong As LongPtr) As LongPtr
#Else
Private Declare PtrSafe Function GetWindowLongPtr Lib "user32.dll" Alias "GetWindowLongA" ( _
ByVal hwnd As LongPtr, _
ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hwnd As LongPtr, _
ByVal nIndex As Long, _
ByVal dwNewLong As LongPtr) As LongPtr
#End If
Private Declare PtrSafe Function FindWindowA Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function DrawMenuBar Lib "user32.dll" ( _
ByVal hwnd As LongPtr) As Long
Private Declare PtrSafe Function SendMessageA Lib "user32.dll" ( _
ByVal hwnd As LongPtr, _
ByVal wMsg As Long, _
ByVal wParam As LongPtr, _
ByRef lParam As Any) As LongPtr
Private Declare PtrSafe Function ReleaseCapture Lib "user32.dll" () As Long
Private wHandle As LongPtr
'Startroutine, wird ausgeführt bevor die Eingabemaske angezeigt wird
Private Sub UserForm_Initialize()
Dim breite As Single
Dim breite2 As Single
Dim höhe As Single
Dim höhe2 As Single
Dim ftop As Single
Dim fleft As Single
Dim zoomfa As Single
wHandle = FindWindowA("ThunderDFrame", Caption)
If wHandle 0 Then
DrawMenuBar wHandle
End If
' breite und höhe
'Userform
breite = Width
höhe = Height
'Excel-Fenster
breite2 = Application.Width
höhe2 = Application.Height
ftop = Application.Top
fleft = Application.Left
StartUpPosition = 0
Left = fleft
Top = ftop
Width = breite2 - 2
Height = 155
If breite2 Initialisierung der Combobox
Call UF1_Standard(Me, True)
End Sub
Im Modul "testen"
Public Sub ALLEFilterAUS()
Dim xLo As ListObject
Dim xWs As Worksheet
Application.ScreenUpdating = False
For Each xWs In ThisWorkbook.Worksheets
For Each xLo In xWs.ListObjects
With xLo.AutoFilter
If .FilterMode Then Call .ShowAllData
End With
Next
Next
Application.ScreenUpdating = True
End Sub
Gruß
Nepumuk