Scrolling Event

Scrolling Event in Excel hinzufügen

Um unsere Navigationsleiste zu jeder Zeit sichtbar zu haben, erstellen wir ein Scroll Event, das Code ausführt, sobald der Benutzer scrollt. Anschließend schreiben wir ein Makro, das unsere Navigationsleiste mit Hamburger-Menü verschiebt. Somit ist unsere Navigationsleiste stets an die aktuelle Scrollposition angepasst. Die selbe Technik können wir auch dazu nutzen, um Bilder oder Objekte zu fixieren.

 

Code

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#If VBA7 Then
Private Declare PtrSafe Function SetTimer Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIDEvent As LongPtr, _
ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As LongPtr
Private Declare PtrSafe Function KillTimer Lib "user32" ( _
ByVal hWnd As LongPtr, ByVal nIDEvent As LongPtr) As Long
#Else
Private Declare Function SetTimer Lib "user32" ( _
ByVal hWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" ( _
ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
#End If
'Bereitgestellt von VBATrainer: www.vbatrainer.de
#If VBA7 Then Private Declare PtrSafe Function SetTimer Lib "user32" ( _ ByVal hWnd As LongPtr, ByVal nIDEvent As LongPtr, _ ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As LongPtr Private Declare PtrSafe Function KillTimer Lib "user32" ( _ ByVal hWnd As LongPtr, ByVal nIDEvent As LongPtr) As Long #Else Private Declare Function SetTimer Lib "user32" ( _ ByVal hWnd As Long, ByVal nIDEvent As Long, _ ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long Private Declare Function KillTimer Lib "user32" ( _ ByVal hWnd As Long, ByVal nIDEvent As Long) As Long #End If 'Bereitgestellt von VBATrainer: www.vbatrainer.de
#If VBA7 Then
    Private Declare PtrSafe Function SetTimer Lib "user32" ( _
        ByVal hWnd As LongPtr, ByVal nIDEvent As LongPtr, _
        ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As LongPtr

    Private Declare PtrSafe Function KillTimer Lib "user32" ( _
        ByVal hWnd As LongPtr, ByVal nIDEvent As LongPtr) As Long
#Else
    Private Declare Function SetTimer Lib "user32" ( _
        ByVal hWnd As Long, ByVal nIDEvent As Long, _
        ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long

    Private Declare Function KillTimer Lib "user32" ( _
        ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
#End If

'Bereitgestellt von VBATrainer: www.vbatrainer.de

Teile diesen Beitrag

Empfehlungen für dich

Erhalte regelmäßig Tipps & Tricks rund um die Themen Excel, VBA und Design!
Grundlagentraining
Top Beiträge