Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    File Data (v2000)

    How can I pull the 'Date Modified' date on a specific file? For instance, C:Test.xls was modified on 12/17/2004...how can I retrieve that date?
    Thanks!
    Dashiell

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: File Data (v2000)

    You can use code like this:

    Debug.Print CreateObject("Scripting.FileSystemObject").GetFile ("C:Test.xls").DateLastModified

    This doesn't require you to set a reference. If you want more control, set a reference (in Tools | References) to Microsoft Scripting Runtime, and use code like this:

    Dim fso As New Scripting.FileSystemObject
    Dim fil As Scripting.File
    Set fil = fso.GetFile("C:Text.xls")
    Debug.Print fil.DateLastModified
    Set fil = Nothing
    Set fso = Nothing

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: File Data (v2000)

    Perfect. Thanks!!

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: File Data (v2000)

    Does that also include the time component?

    If not, how do you get the time component?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: File Data (v2000)

    Have you tried it? Yes, DateLastModified includes a data AND a time component.

Posting Permissions

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