Delete temp file

C

Carlos

I have the next code:

' Save chart as GIF
fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
TempChart.Export Filename:=fname, filterName:="GIF"
A.ChartObjects(1).Delete
Application.ScreenUpdating = True


I have a userform in which a have a button which displays a chart, and the
chart is saved temporaly in the same folder as the excel file, but after I
close the file the temp.gif is still there in the folder, so what I want is
to erase the file after is Exported or the excel file is closed. Can this be
done ?

Thanks !
 
D

Dave Peterson

Look at Kill in VBA's help.

But I'm not sure when you'd want to actually delete the file.
 
C

Carlos

Thanks Dave!

I did use: Kill (ThisWorkbook.Path & Application.PathSeparator & "temp.gif")

Thank you very much!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top