Results 1 to 3 of 3

Thread: [RESOLVED] Workbook/File Creation Date in Excel VBA

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Location
    Best Place on Earth
    Posts
    363

    Resolved [RESOLVED] Workbook/File Creation Date in Excel VBA

    I am using a macro in Excel VBA which opens a text file as a workbook.

    I need to get the Creation Date of the text file, not the Last Modified date.

    So far I cannot find any way to get the creation date using the Workbooks object in VBA, and FileDateTime sometimes gives the Last Modified date.
    Signature Under Construction

  2. #2
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Workbook/File Creation Date in Excel VBA

    Here is some junk I threw together ... it should be self explanatory. I hope it helps ...
    Code:
    Sub Macro1()
        
        'You must install a refernce to library:  Microsoft Scripting Runtime
        
        Dim fso As New FileSystemObject
        Dim aFile As File    'Handle for fso 'File' Object
        Dim aPath As String
        Dim aName As String
        
        'Set up your filespec
        aPath = "C:\Temp\"
        aName = "JUNK.txt"
        
        If fso.FileExists(aPath & aName) Then
            Set aFile = fso.GetFile(aPath & aName)     '<< Example of setting handle
            MsgBox "The File exists  " & aFile.DateCreated
        End If
    
         'Clean House
        Set aFile = Nothing
        
    End Sub
    Last edited by Webtest; Jul 17th, 2006 at 09:47 AM.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Workbook/File Creation Date in Excel VBA

    MsgBox ActiveWorkbook.BuiltinDocumentProperties("Creation Date")

    Available choices:
    Title
    Subject
    Author
    Keywords
    Comments
    Template
    Last Author
    Revision Number
    Application Name
    Last Print Date
    Creation Date
    Last Save Time
    Total Editing Time
    Number of Pages
    Number of Words
    Number of Characters
    Security
    Category
    Format
    Manager
    Company
    Number of Bytes
    Number of Lines
    Number of Paragraphs
    Number of Slides
    Number of Notes
    Number of Hidden Slides
    Number of Multimedia Clips
    Hyperlink Base
    Number of Characters (with spaces)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

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



Click Here to Expand Forum to Full Width