Excel 2016 - problems with macro that generates a jpg image since upgrade to Excel 2016

NikHag

New Member
Joined
Dec 18, 2016
Messages
1
[FONT=&quot]Hello community, [/FONT]
[FONT=&quot]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=&quot]Public Function exportRange(area As Range, ws As Worksheet, path As String)[/FONT]
[FONT=&quot] Application.ScreenUpdating = True[/FONT]
[FONT=&quot] Application.DisplayAlerts = True[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot] Dim output As String[/FONT]
[FONT=&quot] Dim zoom_coef As Single[/FONT]
[FONT=&quot] output = path[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot] zoom_coef = 70 / ws.Parent.Windows(1).Zoom[/FONT]
[FONT=&quot] [/FONT]
[FONT=&quot] area.CopyPicture xlPrinter[/FONT]
[FONT=&quot] Dim chartobj As ChartObject: Set chartobj = ws.ChartObjects.Add(0, 0, area.Width * zoom_coef, area.Height * zoom_coef)[/FONT]
[FONT=&quot] chartobj.Select[/FONT]
[FONT=&quot] chartobj.Chart.Paste[/FONT]
[FONT=&quot] chartobj.Chart.Export output, "jpg"[/FONT]
[FONT=&quot] chartobj.Delete[/FONT]
[FONT=&quot]End Function[/FONT]
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,954
Messages
5,834,562
Members
430,296
Latest member
Prosen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top