07-17-2017, 06:07 PM
Member function ExcelSheet.Range2Image
Macro Macro2865
function $range $pngFile [double'scale]
Excel.Range r=_Range(range)
r.CopyPicture(Excel.xlScreen Excel.xlPicture)
Excel.Chart im = ws.ChartObjects.Add(33, 39, r.Width, r.Height).Chart
im.Paste
im.ChartArea.Border.LineStyle = 0
if scale>0 and scale!=1.0
,im.ChartArea.Width = im.ChartArea.Width * scale
,im.ChartArea.Height = im.ChartArea.Height * scale
,
,;Scaling fails. DOn't know how to make it work.
,;Error (RT) in <open ":14130: /397">ExcelSheet.Range2Image: 0x80020009, Exception occurred.
,;0x3EC, Unable to set the Width property of the ChartArea class. <help #IDP_ERR>?
im.export(_s.expandpath(pngFile) "PNG")
im.Parent.Delete
Macro Macro2865