Forum Discussion

SWillis2023's avatar
SWillis2023
Copper Contributor
Nov 30, 2023

Preventing TMP files from remaining on external drives

After the Excel update back in the fall of 2021(?), a temporary file (tmp) was created and remained on any external drive to which I saved the Excel file.  This NEVER happened before that update.  No tmp file is created on my computer drive, but only on my external drives.  I've tried looking for the setting I need to change in order to stop this from happening, to no avail.  I've even sent emails to Microsoft Office, but have not received any replies.  Also, many of the tmp files will not let me delete them, indicating I must have administrator permission to do so.  I am the only one using this computer, and I am the owner of it and all of the external drives.  Any suggestions on how I may resolve these two issues?  Thanks in advance!

2 Replies

  • Hhanlin's avatar
    Hhanlin
    Iron Contributor

    Excel creates temporary files during editing to prevent data loss. Sometimes, these files are not deleted automatically if Excel crashes, the file is closed improperly, or if there are permission issues. The fact that TMP files only appear on external drives suggests a change in how Excel handles temp files for external storage, possibly related to updates or security settings.

  • hupuy's avatar
    hupuy
    Copper Contributor

    In Excel File → Options → Save, uncheck Create backup file when saving, or use a VBA script to automatically clean up after closing:

    Private Sub Workbook_BeforeClose()
        Kill ThisWorkbook.Path & \~$.tmp
    End Sub

     

Resources