PDA

View Full Version : Copy my files + Date



Press
09-02-2013, 03:43 PM
Hi,

I need to copy a file, use the following procedure now


Sub Copia_File()
Origine = ThisWorkbook.Path & "\Goods\" & TextBox2.Text & ".db4"
Copia = ThisWorkbook.Path & "\Goods\" & TextBox3.Text & ".db4"
FileCopy Origine, Copia
End Sub


I have to simulate a change to the file.
I use the pc can not open the file in any way, I ask only to update the save date with one of the day.
What code can change the save date ..

Thanks in advance

patel
09-02-2013, 11:41 PM
Sub Copia_File()
Origine = ThisWorkbook.Path & "\Goods\" & TextBox2.Text & ".db4"
Copia = ThisWorkbook.Path & "\Goods\" & TextBox3.Text & Format(Date, "dd-mm-yy") & ".db4"
FileCopy Origine, Copia
End Sub

Press
09-03-2013, 02:30 AM
Hi

I have to simulate a change date to the file.
I just have to simulate the creation date of the file
What you propose does not update the date as requested

Could alternatively create a text file with the extension .db4
I do not have to use in this demo the files in any way

Kenneth Hobs
09-03-2013, 07:02 AM
There is no file property called save date. There is a ModificationDate, CreatedDate, and LastAccessedDate. Changing those properties can cause unexpected problems.

See this link if you want to get or set file times. http://www.cpearson.com/excel/FileTimes.htm