:单元格区域另存为图片
如何把工作表区域另存为图片,研究了一个小时,终于把代码完成,希望大家喜欢。
Sub SheetOutJpg()
Dim Newshape As Shape
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
ActiveSheet.Paste
Set Newshape = ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
With ActiveSheet.ChartObjects.Add(1, 1, 1, 1)
.Width = Newshape.Width
.Height = Newshape.Height
Newshape.Copy
.Chart.Paste
.Chart.Export ActiveWorkbook.Path & "\Myjpg.jpg"
.Delete
End With
Newshape.Delete
MsgBox "恭喜!图片已生成并存放在" & ActiveWorkbook.Path
End Sub