Excel 2010 VBA creation date

2019-02-17 12:08发布

How to get the current workbook file creation date using VBA in excel 2010? I browsed all the properties of ThisWorkBook I don't seem to find something there.

4条回答
虎瘦雄心在
2楼-- · 2019-02-17 12:13

Use

ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date").Value

To List all properties run this macro

Public Sub listProperties()
rw = 1
Worksheets(1).Activate
For Each p In ActiveWorkbook.BuiltinDocumentProperties
    Cells(rw, 1).Value = p.Name
    On Error Resume Next
    Cells(rw, 2).Value = p.Value
    rw = rw + 1
Next
End Sub
查看更多
闹够了就滚
3楼-- · 2019-02-17 12:23

I found that FileDateTime works best.

FileDateTime (application.activeworkbook.path)

Tech on the net says it applies to Excel 2016, 2013, 2011 for Mac, 2010, 2007, 2003, XP, and 2000

MSDN VBA 2010 - FileDateTime

查看更多
Juvenile、少年°
4楼-- · 2019-02-17 12:27
MsgBox ActiveWorkbook.BuiltinDocumentProperties("Creation Date")
'Output: 25.07.2011 14:51:11 

This works for Excel 2003, don't have 2010 to test it. Link to MSDN Doc for Office 2010, there is a list with other available properties on there, too.

查看更多
狗以群分
5楼-- · 2019-02-17 12:31

Use Scripting.FileSystemObject

Dim oFS As Object
Dim creationDate As String

Set oFS = CreateObject("Scripting.FileSystemObject")
creationDate = oFS.GetFile(ThisWorkbook.FullName).DateCreated
查看更多
登录 后发表回答