|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub PicCopy()
ActiveCell.Name = "PicAdd"
Selection.Name = "MyPic"
plv = Selection.ShapeRange.Line.Visible ' = msoTrue=-1
If plv Then
psc = Selection.ShapeRange.Line.ForeColor.SchemeColor '= 10(Red),64(Black)
plw = Selection.ShapeRange.Line.Weight ' = 1.5
pls = Selection.ShapeRange.Line.Style ' = msoLineSingle =1
Selection.ShapeRange.Line.Visible = msoFalse '=0
End If
Selection.Copy
Range("PicAdd").Select
ActiveWorkbook.Names("PicAdd").Delete
ActiveSheet.PasteSpecial Format:="图片 (JPEG)" '英文版为"Picture (JPEG)"
Selection.ShapeRange.ZOrder msoSendToBack
If plv Then
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = psc
Selection.ShapeRange.Line.Weight = plw
Selection.ShapeRange.Line.Style = pls
End If
ActiveSheet.Shapes("MyPic").Delete
End Sub
==========================================
其实,关键代码就一句话。
ActiveSheet.PasteSpecial Format:="图片 (JPEG)"
可以把像素超大的图片,改为按当前显示的尺寸相应的像素。
因此,可以大大地减小文件体积。 |
|