AW: Function und Procedure
27.12.2006 17:55:58
Nepumuk
Hallo Herby,
so geht's natürlich nicht, aber so:
' **********************************************************************
' Modul: Modul2 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Private Declare Function KillTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Function SetTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const GC_CLASSNAMEMSEXCEL = "XLMAIN"
Private Wert As Integer
Private hWnd As Long
Private Sub prcStartTimer()
hWnd = FindWindow(GC_CLASSNAMEMSEXCEL, Application.Caption)
SetTimer hWnd, 0&, 100&, AddressOf prcTimer
End Sub
Private Sub prcStopTimer()
KillTimer hWnd, 0&
End Sub
Private Sub prcTimer(ByVal hWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long)
On Error Resume Next
Call prcStopTimer
Call Zwischenergebnis
End Sub
Function Endergebnis(Zelle As Range) As Integer
Endergebnis = Cint(Zelle.Value * 4)
If Zelle.Value > 9 Then
Wert = Zelle.Value
Call prcStartTimer
End If
End Function
Sub Zwischenergebnis()
Range("D2").Value = Wert
End Sub
Gruß
Nepumuk