Excel使用vba删除占用磁盘空间影响速度的无用对象
Excel    2022-06-10 11:59:03    123    0    0
maker   Excel
  1. 打开Excel文件;
  2. 找到开发工具 -> Visual Basic 打开VBA窗口;
  3. 没有开发工具请在 文件 -> 选项 中把 开发工具 打 V 即可;
  4. 输入以下代码,按F5,运行一次,然后关闭保存即可。
Sub Shapes1()
'Delete all Objects except Comments
    On Error Resume Next
    ActiveSheet.DrawingObjects.Visible = True
    ActiveSheet.DrawingObjects.Delete
    On Error GoTo 0
End Sub


删除所有文本框 对象:

Sub deletealltextboxes()
ActiveSheet.TextBoxes.Delete
End Sub


删除所有相片对象:

Sub deleteallpics()
Dim pic As Object
For Each pic In ActiveSheet.Pictures
pic.Delete
Next pic






 

Sub Shapes1()
'Delete all Objects except Comments
    On Error Resume Next
    ActiveSheet.DrawingObjects.Visible = True
    ActiveSheet.DrawingObjects.Delete
    On Error GoTo 0
End Sub

 


Pre: 家庭会议

Next: win10打开ie自动跳到edge(始终用IE打开不跳转)

123
Table of content