我正在尝试执行以下操作:
- 复制工作簿
- 删除一些床单
- 将其另存为其他文件名
这是我的尝试,但它不起作用:
Private Sub publish()
Dim new_wb As Workbook
'Doesnt seem to compile??
Set new_wb = ActiveWorkbook.Sheets.Copy
For i = new_wb.Sheets.Count To 1
If InStr(LCase(new_wb.Sheets(i).CodeName), "output") = 0 Then
new_wb.Sheets(i).Delete
End If
i = i - 1
Next
Application.DisplayAlerts = False
new_wb.SaveCopyAs Filename:=Range("output_path").Value
new_wb.Close
Application.DisplayAlerts = True
End Sub
有人可以帮助我哪里出错了吗?