[FONT="]Hello community, [/FONT]
[FONT="]I have since the upgrade to Excel 2016 experienced a problem with a macro that generates a jpg image of a designated excel area. In the previous versions, it worked without problems but since the upgrade the macro only generates a blank jpg. Have anyone experienced something similar? The code is the following: [/FONT]
[FONT="]Public Function exportRange(area As Range, ws As Worksheet, path As String)[/FONT]
[FONT="] Application.ScreenUpdating = True[/FONT]
[FONT="] Application.DisplayAlerts = True[/FONT]
[FONT="] [/FONT]
[FONT="] Dim output As String[/FONT]
[FONT="] Dim zoom_coef As Single[/FONT]
[FONT="] output = path[/FONT]
[FONT="] [/FONT]
[FONT="] zoom_coef = 70 / ws.Parent.Windows(1).Zoom[/FONT]
[FONT="] [/FONT]
[FONT="] area.CopyPicture xlPrinter[/FONT]
[FONT="] Dim chartobj As ChartObject: Set chartobj = ws.ChartObjects.Add(0, 0, area.Width * zoom_coef, area.Height * zoom_coef)[/FONT]
[FONT="] chartobj.Select[/FONT]
[FONT="] chartobj.Chart.Paste[/FONT]
[FONT="] chartobj.Chart.Export output, "jpg"[/FONT]
[FONT="] chartobj.Delete[/FONT]
[FONT="]End Function[/FONT]
[FONT="]I have since the upgrade to Excel 2016 experienced a problem with a macro that generates a jpg image of a designated excel area. In the previous versions, it worked without problems but since the upgrade the macro only generates a blank jpg. Have anyone experienced something similar? The code is the following: [/FONT]
[FONT="]Public Function exportRange(area As Range, ws As Worksheet, path As String)[/FONT]
[FONT="] Application.ScreenUpdating = True[/FONT]
[FONT="] Application.DisplayAlerts = True[/FONT]
[FONT="] [/FONT]
[FONT="] Dim output As String[/FONT]
[FONT="] Dim zoom_coef As Single[/FONT]
[FONT="] output = path[/FONT]
[FONT="] [/FONT]
[FONT="] zoom_coef = 70 / ws.Parent.Windows(1).Zoom[/FONT]
[FONT="] [/FONT]
[FONT="] area.CopyPicture xlPrinter[/FONT]
[FONT="] Dim chartobj As ChartObject: Set chartobj = ws.ChartObjects.Add(0, 0, area.Width * zoom_coef, area.Height * zoom_coef)[/FONT]
[FONT="] chartobj.Select[/FONT]
[FONT="] chartobj.Chart.Paste[/FONT]
[FONT="] chartobj.Chart.Export output, "jpg"[/FONT]
[FONT="] chartobj.Delete[/FONT]
[FONT="]End Function[/FONT]