+ Reply to Thread
Results 1 to 4 of 4

Getting timestamp from a file in Excel

  1. #1
    Patrick
    Guest

    Getting timestamp from a file in Excel

    Hi,

    I'm looking for a macro/function that will allow me to get the
    timestamps properties (date created) for a file in Excel and paste this
    into a particular cell.

    I imagined the set up would be something like:

    Cell A1 - File location
    Cell B1 - File name
    Cell C1 - =Today()
    Cell D1 - Some formula/macro/function that says "If the datestamp of
    A1&B1 is the same as C1 then put a tick"

    Can anyone help?

    Many Thanks
    Patrick

  2. #2
    Duke Carey
    Guest

    RE: Getting timestamp from a file in Excel

    You can get the creation date in VBA via:

    activeworkbook.BuiltinDocumentProperties("creation date")

    "Patrick" wrote:

    > Hi,
    >
    > I'm looking for a macro/function that will allow me to get the
    > timestamps properties (date created) for a file in Excel and paste this
    > into a particular cell.
    >
    > I imagined the set up would be something like:
    >
    > Cell A1 - File location
    > Cell B1 - File name
    > Cell C1 - =Today()
    > Cell D1 - Some formula/macro/function that says "If the datestamp of
    > A1&B1 is the same as C1 then put a tick"
    >
    > Can anyone help?
    >
    > Many Thanks
    > Patrick
    >


  3. #3
    Registered User
    Join Date
    03-09-2005
    Posts
    13
    I am not all that familiar with VBA. Could anyone give me a step by step to getting this to work. I tried on my own first but was unsucessful.

    Thanks.

  4. #4
    Gareth
    Guest

    Re: Getting timestamp from a file in Excel

    This should get you started:

    Look in VBA help under BuiltinDocumentProperties for more details. You
    might like to change what sh and wb are in order that you don't write
    over existing data and you report the details of the correct file.

    HTH,
    Gareth

    Sub GetFileDetails()

    Dim wb As Workbook
    Dim sh As Worksheet

    Set sh = ActiveSheet
    Set wb = ActiveWorkbook

    With sh
    .Cells(1, 1).Value = "File name:"
    .Cells(1, 2).Value = wb.Name
    .Cells(2, 1).Value = "Location:"
    .Cells(2, 2).Value = wb.Path
    .Cells(3, 1).Value = "Created:"
    .Cells(3, 2).Value = Format( _
    wb.BuiltinDocumentProperties("creation date"), _
    "dd mmm yyyy")
    .Cells(4, 1).Value = "Created Today?"
    .Cells(4, 2).Value = Date = DateSerial( _
    Year(wb.BuiltinDocumentProperties("creation date")), _
    Month(wb.BuiltinDocumentProperties("creation date")), _
    Day(wb.BuiltinDocumentProperties("creation date")))

    End With

    Set wb = Nothing
    Set sh = Nothing

    End Sub


    jesterhs wrote:
    > I am not all that familiar with VBA. Could anyone give me a step by step
    > to getting this to work. I tried on my own first but was unsucessful.
    >
    > Thanks.
    >
    >


+ 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