ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save as JPG or PNG (https://www.excelbanter.com/excel-programming/364561-save-jpg-png.html)

Spike[_3_]

Save as JPG or PNG
 
Is there any way to save a range/selection of excel cells as a jpg or png or
any picture format.

I have a graph on an excel page, and i want the jpg to also contains the
information in the cells about it.

I know how to save the chart by itself....
ActiveChart.Export Filename:=MyFiles.BuildPath(ScansPath, TestNumber) & " "
& RunNumber & ".png", FilterName:="PNG"

But have no idea how to print/export a page to a picture format.

Any help at all would be great, thanks,

--
Jeff "Spike" Zapinski
FAS Project Engineer

Andy Pope

Save as JPG or PNG
 
Hi,

You can copy the range and paste in within the chart before exporting.
Something like this

' chart data
Range("B2:C6").CopyPicture xlScreen
With ActiveChart
.Paste
.Export "C:\temp\pic1.gif", "gif"
End With
'ActiveChart.Export Filename:= _
' MyFiles.BuildPath(ScansPath, TestNumber) & " " _
' & RunNumber & ".png", FilterName:="PNG"

Cheers
Andy

Spike wrote:
Is there any way to save a range/selection of excel cells as a jpg or png or
any picture format.

I have a graph on an excel page, and i want the jpg to also contains the
information in the cells about it.

I know how to save the chart by itself....
ActiveChart.Export Filename:=MyFiles.BuildPath(ScansPath, TestNumber) & " "
& RunNumber & ".png", FilterName:="PNG"

But have no idea how to print/export a page to a picture format.

Any help at all would be great, thanks,


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

Spike[_3_]

Save as JPG or PNG
 
Andy,

I hate you!! J/k. No, in all seriously though, thank you very much!!
Although i dont understand why i cant print a page to a jpg real easily, the
solution you have provided is one i have been searching for, well, for a long
time. I cant believe i have never come across that before, or maybe i just
never worded the question right before. i dont know. But thank you very very
much.

--
Jeff "Spike" Zapinski
FAS Project Engineer


"Andy Pope" wrote:

Hi,

You can copy the range and paste in within the chart before exporting.
Something like this

' chart data
Range("B2:C6").CopyPicture xlScreen
With ActiveChart
.Paste
.Export "C:\temp\pic1.gif", "gif"
End With
'ActiveChart.Export Filename:= _
' MyFiles.BuildPath(ScansPath, TestNumber) & " " _
' & RunNumber & ".png", FilterName:="PNG"

Cheers
Andy

Spike wrote:
Is there any way to save a range/selection of excel cells as a jpg or png or
any picture format.

I have a graph on an excel page, and i want the jpg to also contains the
information in the cells about it.

I know how to save the chart by itself....
ActiveChart.Export Filename:=MyFiles.BuildPath(ScansPath, TestNumber) & " "
& RunNumber & ".png", FilterName:="PNG"

But have no idea how to print/export a page to a picture format.

Any help at all would be great, thanks,


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com