excel - 将范围另存为图像
问题描述
我正在处理基于过滤条件的数据,我想将我的表格保存为图像。
尝试处理此代码但收到错误“需要对象”
请帮忙
Sub Example1()
Dim i As Integer
Dim intCount As Integer
Dim objPic As Shape
Dim objChart As Chart
'copy the range as an image
Selection.AutoFilter
ActiveSheet.Range("$A$1:$H$282").AutoFilter Field:=2, Criteria1:= _
"ABCD"
Set Str = Range("A1").CurrentRegion.Select **'This I Need to transfer as Image**
Call Sheet1.Range("A1").CurrentRegion.Select.CopyPicture(xlScreen, xlPicture) 'Getting Error
'remove all previous shapes in sheet2
intCount = Sheet2.Shapes.Count
For i = 1 To intCount
Sheet2.Shapes.Item(1).Delete
Next i
'create an empty chart in sheet2
Sheet2.Shapes.AddChart
'activate sheet2
Sheet2.Activate
'select the shape in sheet2
Sheet2.Shapes.Item(1).Select
Set objChart = ActiveChart
'paste the range into the chart
objChart.Paste
'save the chart as a JPEG
objChart.Export ("C:\Output\StuffBusinessTempExample.Jpeg")
End Sub