AW: wenn aktive Zelle ungeschützt, ganze Zeile löschen
17.01.2008 22:12:54
tursiops
Ja genau! Klappt einwandfrei. Vielen Dank. Wegen der automatischen Abschaltung habe ich auch etwas gefunden. Dencke, ich kriege das hingebastelt.
Option Explicit
Private WaitForAction As Boolean
Private Action As tAction
Public Enum tAction
acNoAction = 0
acCommand1 = 1
acCommand2 = 2
acTimer = 3
End Enum
Private Sub cmdCommand1_Click()
WaitForAction = False
Action = acCommand1
End Sub
Private Sub cmdCommand1_KeyPress(KeyAscii As Integer)
If (Chr$(KeyAscii) = "2") And (cmdCommand2.Visible) Then
cmdCommand2_Click
Else
cmdCommand1_Click
End If
End Sub
' Shows Messagebox
Public Function showMessage(ByVal Message As String, ByVal title As String, ByVal _
button1Caption As String, ByVal button2Caption As String, Optional timerSec As Long = 60) As tAction
Debug.Assert timerSec "" Then
cmdCommand1.Visible = True
cmdCommand1.Caption = "&1: " & button1Caption
Else
cmdCommand1.Visible = False
End If
If button2Caption "" Then
cmdCommand2.Visible = True
cmdCommand2.Caption = "&2: " & button2Caption
Else
cmdCommand2.Visible = False
End If
Timer1.Interval = timerSec * 1000
Timer1.Enabled = True
Me.Show
While WaitForAction
DoEvents
Wend
Timer1.Enabled = False
showMessage = Action
Unload Me
End Function
Private Sub cmdCommand2_Click()
WaitForAction = False
Action = acCommand2
End Sub
Private Sub cmdCommand2_KeyPress(KeyAscii As Integer)
If (Chr$(KeyAscii) = "1") And (cmdCommand1.Visible) Then
cmdCommand1_Click
Else
cmdCommand2_Click
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If WaitForAction Then Cancel = True
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
WaitForAction = False
Action = acTimer
End Sub