Da wollte ich doch mal schnell eine UserForm in meine Excelmappe einfügen damit wenn sie startet ein Fenster aufgeht was sich nach 20 sekunden wieder schließt und eine Funktion ausführt.
Aber nix da! In Excel existiert das Timer werkzeug nicht 🙁
Noch mal schnell gegoogelt aber das richtig war nicht dabei also selbst was machen 🙂
Und ich finde mein ergebniss kann sich sehen lassen geht bestimmt 1000 mal besser aber so gehts auch 😛
Code:
Dim i As Integer
Dim bolAbbruch As Boolean‚Button zum Abbrechen des Timers
Private Sub cmdAbbrechen_Click()
bolAbbruch = TrueEnd Sub
‚Wird beim öffnen oder aktivieren der UserForm gestartet
Private Sub UserForm_Activate()DoEvents
Call MYTimerEnd Sub
‚Die Tolle Timer funktion 😉
Function MYTimer()DoEvents
i = 0
Do
If i < 20 Then
Call onesec
i = i + 1
End IftxtZeit = 20 – i
DoEvents
Loop Until i = 20 Or bolAbbruch = TrueIf bolAbbruch = False Then
Call Programm_Ausfuehren
Else
Unload Me
End IfDebug.Print Time
End Function
‚Dieses Funktion wartet immer eine sekunde
Function onesec() As Booleanstrsek = Second(Time)
Do
DoEvents
Loop While Second(Time) = strsekonesec = True
End Function
‚Die Funktion die am ende der 20 Sekunden aufgerufen wird
Function Programm_Ausfuehren()MsgBox „test“
Unload MeEnd Function
Google Tags:
excel timer function
I am really loving the theme/design of your web site. Do you ever run into any web browser compatibility problems? A small number of my blog visitors have complained about my site not working correctly in Explorer but looks great in Chrome. Do you have any tips to help fix this issue?