|
学习中,无意冒犯,在2016后的版本,存为图片要增加一句 .Parent.Select ,不然导出的图片会是空白
Sub SaveToPic(Path As String, File As String, Ran As Range)
Ran.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
With ActiveSheet.ChartObjects.Add(0, 0, Ran.Width, Ran.Height).Chart '
.Parent.Select
.Paste
.Export Filename:=Path & File & ".jpg", FilterName:="jpg"
.Parent.Delete
End With
End Sub
|
|