Excel copy a text file into a backup folder

Copy a text file into a backup folder, delete the original, and add todays date and time to the backup filename.

Dim FileUser As String
Dim FileuserDocFILE As String
Dim output As String

'Move the updated file
Dim d As String, ext, x
Dim srcPath As String, destPath As String, srcFile As String
srcPath = ThisWorkbook.Path & "\"
destPath = ThisWorkbook.Path & "\Backup\"
'ext = Array("*.csv", "*.xls")
'For Each x In ext
d = "Example.txt"
' Do While d <> ""
srcFile = srcPath & d
FileCopy srcFile, destPath & Format(Now(), "mm.dd.yy.hh.mm.ss") & "_" & d
Kill srcFile
'd = Dir

Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us
the web designer group uk
the webdesigner group logo

Close Button

Web Site Designed by

The Web Designer Group