[Excel] API - Timer. VBA-Editor Offen - Ja, Nein...
#1
Moin, 19 

API Timer überwacht, ob der VBA-Editor offen ist, oder nicht: 21 

Code:
Option Explicit
    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
    Private lngTimer As LongPtr
    Const TIMERYES = &H113
Public Sub Start_Timer()
    lngTimer = SetTimer(0&, 0&, 800, AddressOf V_B_E)
End Sub
Public Sub Kill_Timer()
    KillTimer 0&, lngTimer
    Tabelle1.Cells(1, 1).Value = vbNullString
End Sub
Private Sub V_B_E(ByVal hwnd As LongPtr, ByVal uMsg As LongPtr, ByVal wParam As LongPtr, ByVal lParam As LongPtr)
    On Error Resume Next
    Tabelle1.Cells(1, 1).Value = IIf(uMsg = TIMERYES And Application.VBE.MainWindow.Visible, "YES...", "NO...")
    On Error GoTo 0
End Sub
[-] Folgende(r) 2 Nutzer sagen Danke an Gast für diesen Beitrag:
  • maninweb, volti
Antworten Top


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste