I am a supporter of
St. Joseph's hospice.
 If you find this site useful or if it helped you, consider a small donation to
St. Joseph's, please.

Information on
St. Joseph's

JustGiving - Sponsor me now!



Use this sub if you need to export a worksheet range into a jpg file.

I found this is one of the most convenient ways to present Excel results in a PowerPoint presentation. Thanks to my colleague Ashish P. I could change xlScreen to xlPrinter which will avoid the program to fail in some cases.

Sub sbExportRange2Picture(sPath As String, rngInput As Range)
'Export range as image
'Change History:
'Version Date       Programmer Change
'1       03/06/2017 Bernd      Create
'2       11/07/2017 Bernd      Change xlScreen to xlPrinter

Dim chtObj As ChartObject

rngInput.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
Set chtObj = ActiveSheet.ChartObjects.Add(100, 30, 400, 250)
chtObj.Name = "TemporaryPictureChart"
chtObj.Width = rngInput.Width
chtObj.Height = rngInput.Height

'I hate to activate anything but nothing else seems to work.
'If you find a better way, let me know: www.sulprobil.com
ActiveChart.Export FileName:=sPath, FilterName:="jpg"


End Sub

Sulprobil   Get it done   Contact   Disclaimer   Impressum   Download