5,172
社区成员




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
Dim timer
Private Sub btnStart_Click()
Call endC
Call Module1.initVariable(1, TextBox1.Text, TextBox2.Text)
Call startC
End Sub
Private Sub btnStop_Click()
Call endC
End Sub
Private Sub startC()
timer = SetTimer(0, 0, 80, AddressOf Module1.Scintill)
End Sub
Private Sub endC()
Call KillTimer(0, timer)
End Sub
Dim sheetIdx As Integer
Dim rowCnt As Integer
Dim colCnt As Integer
Dim flag As Boolean
Sub initVariable(ByVal var0 As Integer, ByVal var1 As Integer, ByVal var2 As Integer)
sheetIdx = var0
flag = True
rowCnt = var1
colCnt = var2
End Sub
Sub Scintill()
If Val(Application.Version) >= 10 Then
If Application.Ready Then
Call SetBgColor
End If
Else
Call SetBgColor
End If
End Sub
Sub SetBgColor()
If flag Then
'MsgBox (Worksheets(sheetIdx).Cells(rowCnt, colCnt).Interior.ColorIndex)
Worksheets(sheetIdx).Cells(rowCnt, colCnt).Interior.ColorIndex = 0
flag = False
Else
'MsgBox (Worksheets(sheetIdx).Cells(rowCnt, colCnt).Interior.ColorIndex)
Worksheets(sheetIdx).Cells(rowCnt, colCnt).Interior.ColorIndex = 6
flag = True
End If
End Sub
MsgBox (Worksheets(sheetIdx).Cells(rowCnt, colCnt).Interior.ColorIndex)
Worksheets(sheetIdx).Cells(rowCnt, colCnt).Interior.ColorIndex = 6