Modify File Creation date in VBA using Document properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon, all.

Is there a reason why the following doesn't work?

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Creation Date:").Value =
"06/03/07"
End Sub

Does the date have to be in a particular format, or it is simply because
there are some properties you just can't change?

Thanks in advance

Pete
 
You have to use the correct name.

From the immediate window as a demonstration:

? ActiveWorkbook.BuiltinDocumentProperties.Item("Creation Date").Value
3/8/2006 10:16:50 AM

ActiveWorkbook.BuiltinDocumentProperties.Item("Creation Date").Value =
"2/25/1987"

? ActiveWorkbook.BuiltinDocumentProperties.Item("Creation Date").Value
2/25/1987

This will be reflected under the statistics tab in Properties.
 
Tom, Thanks for this. So, there's nothing I can do about entries in the
General tab, then?

Regards

Pete
 
I believe those are taken from the file system. You would need to use the
Windows API or maybe one of the scripting tools (scripting runtime/file
system object perhaps) to modify them after you closed the file if that is
possible - which I can't say if it is possible off the top of my head).
 
Chip, it changes the value on the "Statistics" tab, but the value in the
"General" tab remains unchanged.
Cheers
Pete
 
Tom,
It all sounds a bit complex for my tiny brain, although I'm at a loss to
understand why :
ThisWorkbook.BuiltinDocumentProperties("Creation Date").Value = Now
alters the value in the "Statistics" tab, but not the "General" tab.
Oh well, never mind - thanks for your interest :-)

Pete
 
Back
Top