Hi,
My code for exporting a .gif of a range worked fine but lately I get an error at this line:
[/pre]
My code for exporting a .gif of a range worked fine but lately I get an error at this line:
Code:
chtObj.Chart.Export sFile
Can anyone help solving my problem?
Thanks,
govi
The whole code:
[pre]Sub ExportGrafiekWorkoutdata()
Sheets("grafieken_workoutdata").Select
Dim sfilename As String
Dim chtObj As ChartObject
Dim cht As Chart
sFile = "D:DropboxPortableAHKDropboxPublicworkoutworkoutdata.gif"
'sFile = "D:DropboxPublicworkoutworkoutdata.gif"
On Error Resume Next
Kill sFile
On Error GoTo 0
With Range("B1:AM47")
'.Value = 123.4567 ' just for testing of course
.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
'size to range plus a bit for chart border
Set chtObj = ActiveSheet.ChartObjects.Add( _
.Left, .Top, .Width + 6, .Height + 6)
End With
chtObj.Chart.Paste
chtObj.Chart.Export sFile
chtObj.Delete
End Sub