Hi Gerencsér
Here is code to play with
See
http://www.mvps.org/dmcritchie/excel/xl2gif.htm
Or this example that save as c:\range.gif
Sub Testing()
Application.ScreenUpdating = False
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set ctoTheChartHolder = ActiveSheet.ChartObjects.Add(0, 0, 800, 600)
Set chtTheChart = ctoTheChartHolder.Chart
' Paste the picture onto the chart and
' set an object variable for it
ctoTheChartHolder.Activate
With chtTheChart
.ChartArea.Select
.Paste
Set picThePicture = .Pictures(1)
End With
' Set the picture's properties...
With picThePicture
.Left = 0
.Top = 0
sglWidth = .Width + 7
sglHeight = .Height + 7
End With
' Change the size of the chart object to fit the picture
'better
With ctoTheChartHolder
.Border.LineStyle = xlNone
.Width = sglWidth
.Height = sglHeight
End With
' Export the chart as a graphics file
blnRet = chtTheChart.Export(Filename:="c:\range.gif", _
FilterName:="gif", Interactive:=False)
ctoTheChartHolder.Delete
Application.ScreenUpdating = True
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Gerencsér Gábor" wrote in message ...
Hi there,
Hitting a CommandButton I would like to have the Print_Area on my sheet in MyWorkbook.xls saved as MyWorkbook2006-02-09.gif.
(Unfortunately I don't have Adobe acrobat to make .pdf.)
For some reason the code below just does not work and I cannot fix it.
I would appreciate some advise.
I am working in Excel2003
Sub SaveRangeAsGIF()
Dim strDate As String
Dim MyPath, MyName, MyFullName, MyPathName
MyPath = Application.ActiveWorkbook.Path
MyName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
strDate = Format(Date, "yyyy-mm-dd")
MyFullName = MyName & "-" & strDate & ".gif"
MyPathName = ThisWorkbook.Path & "\" & MyName & "-" & strDate & ".gif"
Response = MsgBox("Do you want to save the Print_Area as " & MyFullName, vbYesNo, "GIFmaker")
If Response = vbYes Then
Range("Print_Area").Export FileName:=MyPathName, FilterName:="GIF"
End If
End Sub
Gabor