|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub sExportShp2GIF()
Dim objShp As Shape, H, W, sku
Dim i As Integer
Dim c As ChartObject
For i = 1 To ActiveSheet.Shapes.Count
Set objShp = ActiveSheet.Shapes(i)
sku = ActiveSheet.Cells(objShp.TopLeftCell.Row, objShp.TopLeftCell.Column - 1)
W = objShp.Width
H = objShp.Height
objShp.Width = 768
objShp.Height = 768
objShp.CopyPicture
Set c = ActiveSheet.ChartObjects.Add(0, 0, objShp.Width, objShp.Height)
c.Activate
c.Chart.Paste
c.Chart.Export ThisWorkbook.Path & "\" & sku & ".jpg"
c.Delete
objShp.Width = W
objShp.Height = H
Next i
Set objShp = Nothing
End Sub
|
|