好代码,改进下,加进图片命名,可以在当前工作簿路径存一张以上图片。 Sub SheetOutJpg() Dim Newshape As Shape, myname As String Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture ActiveSheet.Paste myname = InputBox("请输入图片名字:") 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 & "\" & myname & ".JPG" .Delete End With Newshape.Delete MsgBox "恭喜!图片已生成并存放在" & ActiveWorkbook.Path End Sub
[此贴子已经被作者于2007-9-1 9:12:26编辑过] |