Option Explicit
Sub test()
Dim pth1 As String
pth1 = "e:\test.xlsx"
clear_wb pth1
End Sub
Private Sub clear_wb(ByVal pth As String)
Dim wb As Workbook, sht As Worksheet
Set wb = Application.Workbooks.Open(pth)
Application.DisplayAlerts = False
For Each sht In wb.Sheets
sht.Cells.Clear
Next sht
wb.Save
wb.Close False
Set wb = Nothing
Application.DisplayAlerts = True
MsgBox "指定工作簿数据清除完毕!"
End Sub
温馨提示:内容为网友见解,仅供参考