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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
Use Scripting.FileSystemObject
Dim oFS As Object
Dim creationDate As String
Set oFS = CreateObject("Scripting.FileSystemObject")
creationDate = oFS.GetFile(ThisWorkbook.FullName).DateCreated
回答3:
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
回答4:
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