新建一个空白的文档 工具—宏—宏安全性—选择“中”
之后 alt+f11打开vb编辑器 插入新模块后 把下面这段代码粘帖进去 保存后退出
打开刚才保存的文件 如果弹出安全提示 选择“启用宏”
就会自动运行并清除所有startup代码
-------------------------------开始复制--------------------------------
Sub Auto_Open()
Dim FS As Object
Dim BK As Workbook
Dim SHT As Worksheet
Dim ifExist As Boolean
On Error Resume Next
'判断是否存在StartUp,以ifExist标记
ifExist = False
If Dir(Application.StartupPath & "\" & "StartUp.xls") <> "" Then ifExist = True
If ifExist = False Then
For Each BK In Workbooks
If ifExist Then Exit For
For Each SHT In BK.Sheets
If ifExist Then Exit For
If BK.Sheets("StartUp").Name <> "StartUp" Then
ifExist = False
Else
ifExist = True
End If
Next SHT
Next BK
End If
'判断是否清除StartUp
If ifExist Then
If MsgBox("发现StartUp!" & vbCrLf & "StartUp可能影响你的Excel!是否清除?", vbOKCancel) = vbCancel Then Exit Sub
Else
MsgBox "未发现StartUp,自动退出"
ThisWorkbook.Close
Exit Sub
End If
'关闭StartUp.xls
Workbooks("StartUp.xls").Close False
'删除文件
Set FS = CreateObject("Scripting.FileSystemObject")
FS.DeleteFile Application.StartupPath & "\" & "StartUp.xls"
'删除宏模块StartUp
Application.DisplayAlerts = False
For Each BK In Workbooks
BK.Sheets("StartUp").Delete
Next BK
Application.DisplayAlerts = True
'恢复变量
Application.OnSheetActivate = ""
Application.OnKey "%{F11}"
Application.OnKey "%{F8}"
MsgBox "清除StartUp完毕,自动退出!"
ThisWorkbook.Close
End Sub
-----------------------------------------------复制结束--------------------------------------
大概是启动时的模板设置成了STARTUP
现象:打开excel文件时,会自动打开一份叫startup.xls的文件,
解决办法:关闭所有的excel文件后,删除c:\Documents and Settings\Administrator\Application Data\Microsoft\Excel\XLSTART\文件夹里面有个StartUp.xls.,如果没有效果,直接将xlstart文件夹给删了。应当说这并不是病毒,只是一些误操作引起的。
一、删除
C:\Documents and Settings\Administrator\Application Data\Microsoft\Excel\Excel11.xls
,该文件删除后,Excel会自动重建的;
二、删除
C:\Documents and Settings\Administrator\Application Data\Microsoft\Excel\XLSTART\StartUp.xls
;
怎么弄好的,我也遇到这个问题了