Sub
Range_To_Image()
Dim
objPict
As
Object
, objChrt
As
Chart
Dim
rngImage
As
Range, strFile
As
String
On
Error
GoTo
ErrExit
With
Sheets(
"Tabelle1"
)
Set
rngImage = .Range(
"A1:C20"
)
rngImage.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
.PasteSpecial Format:=
"Bitmap"
, Link:=
False
, DisplayAsIcon:=
False
Set
objPict = .Shapes(.Shapes.Count)
strFile =
"E:\Temp\meinBild.gif"
objPict.Copy
Set
objChrt = .ChartObjects.Add(1, 1, objPict.Width + 8, objPict.Height + 8).Chart
objChrt.Paste
objChrt.Export strFile
objChrt.Parent.Delete
objPict.Delete
End
With
ErrExit:
Set
objPict =
Nothing
Set
objChrt =
Nothing
Set
rngImage =
Nothing
End
Sub