![]() |
Delete temp file
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 ! |
Delete temp file
Look at Kill in VBA's help.
But I'm not sure when you'd want to actually delete the file. Carlos wrote: 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 ! -- Dave Peterson |
Delete temp file
Thanks Dave!
I did use: Kill (ThisWorkbook.Path & Application.PathSeparator & "temp.gif") Thank you very much!! "Dave Peterson" wrote: Look at Kill in VBA's help. But I'm not sure when you'd want to actually delete the file. Carlos wrote: 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 ! -- Dave Peterson |
All times are GMT +1. The time now is 12:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com