+ Reply to Thread
Results 1 to 8 of 8

Modify File Creation date in VBA using Document properties

  1. #1
    Peter Rooney
    Guest

    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("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





  2. #2
    Tom Ogilvy
    Guest

    Re: 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("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.

    --
    Regards,
    Tom Ogilvy



    "Peter Rooney" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >
    >
    >
    >




  3. #3
    Peter Rooney
    Guest

    Re: 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("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.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "Peter Rooney" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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
    > >
    > >
    > >
    > >

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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("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.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > >
    > > "Peter Rooney" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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
    > > >
    > > >
    > > >
    > > >

    > >
    > >
    > >




  5. #5
    Chip Pearson
    Guest

    Re: 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" <[email protected]> wrote in
    message
    news:[email protected]...
    > 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
    >
    >
    >
    >




  6. #6
    Peter Rooney
    Guest

    Re: 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" <[email protected]> wrote in
    > message
    > news:[email protected]...
    > > 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
    > >
    > >
    > >
    > >

    >
    >
    >


  7. #7
    Peter Rooney
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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("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.
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > >
    > > >
    > > > "Peter Rooney" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > 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
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >
    > > >

    >
    >
    >


  8. #8
    Chip Pearson
    Guest

    Re: 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" <[email protected]> wrote in
    message
    news:[email protected]...
    > 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" <[email protected]> wrote
    >> in
    >> message
    >> news:[email protected]...
    >> > 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
    >> >
    >> >
    >> >
    >> >

    >>
    >>
    >>




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1