|
本帖最后由 7016427 于 2018-7-9 12:06 编辑
Private Sub cop() ' 以下黄色语句没有执行成功,也没有错误提示
dim t%,sh As Worksheet
Set sh = ThisWorkbook.Sheets("CS22")
If Sheet7.Cells(2, 8).Value = 1 And Environ("COMPUTERNAME") = "LENOVO-3230BD56" Or Sheet7.Cells(2, 8).Value = 1 And Environ("COMPUTERNAME") = "WIN-20170723EPN" Then Run "备份" ' 备份是执行成功的,就是备份完毕时未释放内存
For t = 1 To Sheets.Count
If Sheets(t).Name <> "CS22" Then Sheets(t).Visible = 2
Next t
sh.Cells(24, 35).Value = 1
sh.Shapes("艺术字 913").Visible = False
------------
------------
ThisWorkbook.Close True
'ThisWorkbook = Nothing '释放内存
Set sh = Nothing '释放内存
End Sub
----------------
Private Sub 备份()Dim s$
For Each f In CreateObject("Scripting.FileSystemObject").Drives
If f.drivetype = 1 Then s = f.Path: Exit For
Next
If s = "" Then
MsgBox "请插入U盘,重试!": End
Application.DisplayAlerts = False '覆盖文件
ThisWorkbook.SaveAs Filename:=s & "\bak\日报.xls"
End Sub
|
|