Excel VBA高级编程:单元格区域另存为图片

发布: 2009-2-04 11:51  作者: 网络转载  查看: 1650次 共有0条评论

:单元格区域另存为图片

如何把工作表区域另存为图片,研究了一个小时,终于把代码完成,希望大家喜欢。

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

 

相关阅读
大家对 Excel VBA高级编程:单元格区域另存为图片 的评论
最新PPT教程
最新评论
PPT问答