C
CLR
Hi All......
I have the following code, which I got from these Groups some time ago. It
appears to "run" in all versions of Excel from '97 through 2007, but the
pictures only come through properly in XL2002 and XL2003......the other
versions are inconsistant, and usually break up the size of the picture.
Naturally, my user wants it to work in all versions........
Anybody see anything herein that would work better in 2002/3 than the
others.......or anything else that might help?.......or another way of doing
it? I'm actually making a .jpg of a range of cells that contains both data
and a Chart of that data.
Here's the code.......it's in two pieces.........
Sub MakePic1()
Dim JpgFileName
Dim JpgSheet
Dim JpgRange
JpgRange = Range("JPG!L15").Value
JpgSheet = Range("JPG!k15").Value
Sheets(JpgSheet).Select
CreateImageFile _
TheExportRange:=Range(JpgRange), _
TheFileName:=ThisWorkbook.Path & "\" & Range("jpg!j15").Value, _
TheFileFormat:="jpg"
Sheets("JPG").Select
End Sub
Sub CreateImageFile(TheExportRange As Range, _
TheFileName As String, _
TheFileFormat As String)
TheExportRange.CopyPicture Appearance:=xlScreen, _
Format:=xlPicture
Dim chtobj As ChartObject
Set chtobj = TheExportRange.Parent.ChartObjects.Add(1, 1, 1, 1)
With chtobj
.Height = 700
.Width = 800
.Chart.ChartArea.Border.LineStyle = 0
.Chart.Paste
.Chart.Export Filename:=TheFileName & "." & TheFileFormat, _
FilterName:=TheFileFormat
.Delete
End With
Set chtobj = Nothing
End Sub
Any help would be much appreciated
Vaya con Dios,
Chuck, CABGx3
I have the following code, which I got from these Groups some time ago. It
appears to "run" in all versions of Excel from '97 through 2007, but the
pictures only come through properly in XL2002 and XL2003......the other
versions are inconsistant, and usually break up the size of the picture.
Naturally, my user wants it to work in all versions........
Anybody see anything herein that would work better in 2002/3 than the
others.......or anything else that might help?.......or another way of doing
it? I'm actually making a .jpg of a range of cells that contains both data
and a Chart of that data.
Here's the code.......it's in two pieces.........
Sub MakePic1()
Dim JpgFileName
Dim JpgSheet
Dim JpgRange
JpgRange = Range("JPG!L15").Value
JpgSheet = Range("JPG!k15").Value
Sheets(JpgSheet).Select
CreateImageFile _
TheExportRange:=Range(JpgRange), _
TheFileName:=ThisWorkbook.Path & "\" & Range("jpg!j15").Value, _
TheFileFormat:="jpg"
Sheets("JPG").Select
End Sub
Sub CreateImageFile(TheExportRange As Range, _
TheFileName As String, _
TheFileFormat As String)
TheExportRange.CopyPicture Appearance:=xlScreen, _
Format:=xlPicture
Dim chtobj As ChartObject
Set chtobj = TheExportRange.Parent.ChartObjects.Add(1, 1, 1, 1)
With chtobj
.Height = 700
.Width = 800
.Chart.ChartArea.Border.LineStyle = 0
.Chart.Paste
.Chart.Export Filename:=TheFileName & "." & TheFileFormat, _
FilterName:=TheFileFormat
.Delete
End With
Set chtobj = Nothing
End Sub
Any help would be much appreciated
Vaya con Dios,
Chuck, CABGx3