|
Sub 导出批注中的图片() '此法得到的文件体积最小
Dim rng As Range, Flnm$
Dim Ht, WD
Set sh = ActiveSheet
For Each rng In sh.Cells.SpecialCells(xlCellTypeComments)
If rng.Comment.Shape.Fill.Type = msoFillPicture Then
With rng.Comment
.Visible = True
With .Shape
Ht = .Height
WD = .Width
.CopyPicture 1, 2 '
End With
.Visible = False
End With
If Dir(ThisWorkbook.Path & "\待导出图片", 16) = "" Then MkDir ThisWorkbook.Path & "\待导出图片"
Flnm = ThisWorkbook.Path & "\待导出图片\" & rng.Value & ".jpg"
With sh.ChartObjects.Add(0, 0, WD, Ht).Chart '
.Paste
.Export Flnm, "jpg"
.Parent.Delete
End With
End If
Next
MsgBox "已全部导出到待导出图片文件夹中,请查看"
End Sub
|
评分
-
1
查看全部评分
-
|