'将选中区域保存为图片
Sheets("联合分析").Range("A6:E6").Select
'将A6:E6区域保存为图片,图片名字为picname
picname = Cells(3, 4)
& "-" & Cells(4, 4) & "策略"
Selection.CopyPicture 1, 2
ActiveSheet.Pictures.Paste.Select
With Selection
.Copy
With
ActiveSheet.ChartObjects.Add(Selection.ShapeRange.Left,
Selection.ShapeRange.Top, Selection.Width,
Selection.Height).Chart
.Parent.Select
'选中新建的绘图框,这是office2016版本新增的要求,没有这句会导致导出的图片是一片空白。
.Paste
fnm = ActiveWorkbook.Path
& "\pic\关联分析\" & picname & ".png"
.Export fnm
.Parent.Delete
End
With
.Delete
End With
MsgBox fnm & "已保存"
Exit Sub
加载中,请稍候......