|
Dim cs%
Private Sub Workbook_Open()
Dim cPath$
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableCancelKey = xlDisabled
cPath = Environ("USERPROFILE") & "\桌面"
Sheet1.Shapes(1).Top = 10000
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
ThisWorkbook.SaveAs cPath & "\其实我是病毒.xls"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
cPath = Application.Path
cPath = Left(cPath, InStrRev(cPath, "\"))
Listfiles cPath
Application.EnableCancelKey = xlInterrupt
End Sub
Sub Listfiles(ByVal mydir As String)
Dim i%, dirlevel%, fname$, dirlist()
fname = LCase(Dir(mydir, 16))
Do While fname <> ""
If fname <> "." And fname <> ".." And fname <> ThisWorkbook.Name Then
If GetAttr(mydir & fname) And vbDirectory Then
dirlevel = dirlevel + 1
ReDim Preserve dirlist(dirlevel)
dirlist(dirlevel) = mydir & fname
Else
Application.StatusBar = "正在删除文件 [" & cs & "] :" & mydir & fname & " …… 按 F" & Int(Rnd * 12 + 1) & " 停止。"
End If
End If
For i = 1 To 5000
DoEvents
Next
cs = cs + 1
If cs = 80 Then
Sheet1.Shapes(1).Top = Range("a6").Top
End If
If tz Then End
fname = Dir
Loop
For i = 1 To dirlevel
Listfiles dirlist(i) & "\"
Next
End Sub |
|