ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modify File Creation date in VBA using Document properties (https://www.excelbanter.com/excel-programming/355429-modify-file-creation-date-vba-using-document-properties.html)

Peter Rooney

Modify File Creation date in VBA using Document properties
 
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation 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





Tom Ogilvy

Modify File Creation date in VBA using Document properties
 
You have to use the correct name.

From the immediate window as a demonstration:

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

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

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

This will be reflected under the statistics tab in Properties.

--
Regards,
Tom Ogilvy



"Peter Rooney" wrote in message
...
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation 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







Peter Rooney

Modify File Creation date in VBA using Document properties
 
Tom, Thanks for this. So, there's nothing I can do about entries in the
General tab, then?

Regards

Pete



"Tom Ogilvy" wrote:

You have to use the correct name.

From the immediate window as a demonstration:

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

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

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

This will be reflected under the statistics tab in Properties.

--
Regards,
Tom Ogilvy



"Peter Rooney" wrote in message
...
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation 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








Tom Ogilvy

Modify File Creation date in VBA using Document properties
 
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).

--
Regards,
Tom Ogilvy

"Peter Rooney" wrote in message
...
Tom, Thanks for this. So, there's nothing I can do about entries in the
General tab, then?

Regards

Pete



"Tom Ogilvy" wrote:

You have to use the correct name.

From the immediate window as a demonstration:

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

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

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

This will be reflected under the statistics tab in Properties.

--
Regards,
Tom Ogilvy



"Peter Rooney" wrote in message
...
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation

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










Chip Pearson

Modify File Creation date in VBA using Document properties
 
Try

ThisWorkbook.BuiltinDocumentProperties("Creation Date").Value =
Now



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote in
message
...
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation
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







Peter Rooney

Modify File Creation date in VBA using Document properties
 
Chip, it changes the value on the "Statistics" tab, but the value in the
"General" tab remains unchanged.
Cheers
Pete


"Chip Pearson" wrote:

Try

ThisWorkbook.BuiltinDocumentProperties("Creation Date").Value =
Now



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote in
message
...
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation
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








Peter Rooney

Modify File Creation date in VBA using Document properties
 
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

"Tom Ogilvy" wrote:

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).

--
Regards,
Tom Ogilvy

"Peter Rooney" wrote in message
...
Tom, Thanks for this. So, there's nothing I can do about entries in the
General tab, then?

Regards

Pete



"Tom Ogilvy" wrote:

You have to use the correct name.

From the immediate window as a demonstration:

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

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

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

This will be reflected under the statistics tab in Properties.

--
Regards,
Tom Ogilvy



"Peter Rooney" wrote in message
...
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation

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











Chip Pearson

Modify File Creation date in VBA using Document properties
 
Yeah, you're right. My mistake.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote in
message
...
Chip, it changes the value on the "Statistics" tab, but the
value in the
"General" tab remains unchanged.
Cheers
Pete


"Chip Pearson" wrote:

Try

ThisWorkbook.BuiltinDocumentProperties("Creation Date").Value
=
Now



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Peter Rooney" wrote
in
message
...
Good afternoon, all.

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

Sub ChangeCreationDate()
ActiveWorkbook.BuiltinDocumentProperties.Item("Cre ation
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











All times are GMT +1. The time now is 09:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com