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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Watch MrExcel Video

Forum statistics

Threads
1,129,498
Messages
5,636,665
Members
416,935
Latest member
Atulcp

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