EXCEL的VB实现将选中单元格另存为图片在当前EXCEL所在目录中

如题所述

VBA可实现。复制如下代码到VBA模块中运行。

Private Sub CommandButton1_Click()
Dim my_Range As Range
Set my_Range = Selection
my_Range.CopyPicture

Dim my_Chart As Chart
Set my_Chart = ActiveSheet.ChartObjects.Add(0, 0, my_Range.Width, my_Range.Height).Chart
my_Chart.Paste
my_Chart.Export ThisWorkbook.Path & "\" & "my_Pic.jpg", "JPG"
my_Chart.Parent.Delete
End Sub


温馨提示:答案为网友推荐,仅供参考
相似回答