excel 调用宏Alt +F11
Sub test()
Dim a, b, enddata As String
enddata = "2015-1-21"
b = Format(Date, "yyyy-m-d")
If enddata = b Then
test1
End If
End Sub
Sub test1()
Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
If ActiveWorkbook.Worksheets.Count >= 1 Then
ws.Delete
'sh.Cells.Clear
End If
Next ws
Application.DisplayAlerts = True
End Sub
Sub test()
Dim a, b, enddata As String
enddata = "2015-1-21"
b = Format(Date, "yyyy-m-d")
If enddata = b Then
test1
End If
End Sub
Sub test1()
Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In ActiveWorkbook.Worksheets
ws.Cells.Clear
Next ws
Application.DisplayAlerts = True
End Sub
Word 调用宏Alt + F8
Sub test()
Dim b, enddata As String
enddata = "2015-1-23"
b = Format(Date, "yyyy-m-d")
If enddata = b Then
ActiveDocument.Range.Delete
End If
End Sub