以下是引用downbaidu在2008-2-26 22:25:11的发言:删除excel中所有工作簿中的图片和文字! 我要把里面的图片全部删除,有三个工作表。里面有三个图片,和三个文字。 现在要把里面的三个图片全部删除,还有文字也删除,文字是(下载摆渡)
'* +++++++++++++++++++++++++++++ '* Created By SHOUROU@ExcelHome 2008-2-27 6:39:19 '仅测试于System: Windows NT Excel: 11.0 Language: 2052 '№ 0341^The Code CopyIn [ThisWorkbook- ThisWorkbook]^' '* ----------------------------- Option Explicit Sub Example() Dim oSheet As Worksheet, oShape As Shape Dim myHeight As Single, myWidth As Single Dim DelString As String DelString = "下载摆渡" myHeight = 30 '磅,必须以磅为单位,如以厘米等,则会在单位换算过程中出现误差 myWidth = 450.75 '磅 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '如
以磅为单位返回sheets(1)需要删除的图形(图形1)的宽或者高 ' MsgBox Sheets(1).Shapes(1).Width ' MsgBox Sheets(1).Shapes(1).Heigth ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Application.ScreenUpdating = False For Each oSheet In ActiveWorkbook.Sheets '删除指定宽度高度的浮动式图形 For Each oShape In oSheet.Shapes If oShape.Height = myHeight And oShape.Width = myWidth Then oShape.Delete Next '删除指定文本 oSheet.Cells.Replace What:=DelString, Replacement:="" Next Application.ScreenUpdating = True End Sub '----------------------
|