Sunday, May 31, 2009

Pattern Merah dan Hijau

x = InStr(buff, ReplyFrom)
If x > 0 Then
'header1 = Trim(Mid(buff, 1, x - 1))
Cells(nn, 2).Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Else
Cells(nn, 2).Select
With Selection.Interior
.ColorIndex = 38
.Pattern = xlSolid
End With
End If

Baris Maksimal

Maxbaris = Range("B5").End(xlDown).Row

Delay in Visual Basic

Call Pause(ParamDelay) ' delay for 30 seconds

Sub Pause(ByVal nSecond As Single)
Dim t0 As Single
Dim dummy As Integer

t0 = Timer

Do While Timer - t0 < nSecond
'cursormove = "."
'Application.StatusBar = "Update Status " & countstat & " %" & cursormove

dummy = DoEvents()

' If we cross midnight, back up one day
If Timer < t0 Then
t0 = t0 - 24 * 60 * 60 ' or t0 = t0 - 86400

End If

cursormove = " ."
Application.StatusBar = "Update Status " & countstat & cursormove
Loop

End Sub

' Call the routine from the appropriate event:
' Example:

'Call Pause(30) ' delay for 30 seconds
'Form2.Show

Menampilkan Status

Application.StatusBar = "Update Status " & countstat & " %"

Eksekusi Sheel di VB

Shell "cmd /c ping " & WFile & ">C:\" & WFile & ".txt", vbHide