|
Sub 仅存数据()
Dim sht, shp
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
ActiveWorkbook.Path & "" & ActiveWorkbook.Name & "-纯数据.xlsx", _
FileFormat:=xlOpenXMLWorkbook '另存为xlsx格式 清除宏代码
Sheets.Select
Cells.Select
Selection.Copy '粘贴数值,删除公式
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets(1).Select
For Each sht In Sheets '删除控件
With sht
'.Cells.FormatConditions.Delete '删除条件格式
For Each shp In .Shapes '清除控件
shp.Delete
Next
'.Cells.Validation.Delete '清除有效性
End With
Next
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub
这段代码会提示:方法saveas作用于对象workbook时失败,这怎么解决!各位高手帮忙下,谢谢!
|
|