Hello
I am using this code to export an image "capture" of an excel range. However, I don't know the range of what I need to export, but i know the x - y cordiantes of the corners the area.
Can the CopyPicture method accept X-Y coords? If not, how can I convert x-y into a range?
Thanks in advance!
skimo
I am using this code to export an image "capture" of an excel range. However, I don't know the range of what I need to export, but i know the x - y cordiantes of the corners the area.
Code:
Private Sub SaveRngAsJPG(Rng As Range, FileName As String)
Dim Cht As Chart, bScreen As Boolean, Shp As Shape
bScreen = Application.ScreenUpdating
Application.ScreenUpdating = False
Set Cht = Workbooks.Add(xlChart).Charts(1)
Cht.ChartArea.Clear
Rng.CopyPicture xlScreen, xlPicture
Cht.Paste
With Cht.Shapes(1)
.Left = 0
.Top = 0
.Width = Cht.ChartArea.Width
.Height = Cht.ChartArea.Height
End With
Cht.Export FileName, "JPEG", False
Cht.Parent.Close False
Application.ScreenUpdating = bScreen
End Sub
Can the CopyPicture method accept X-Y coords? If not, how can I convert x-y into a range?
Thanks in advance!
skimo