[英]Excel 2010 VBA creation date
How to get the current workbook file creation date using VBA in excel 2010? 如何在excel 2010中使用VBA获取当前工作簿文件创建日期? I browsed all the properties of ThisWorkBook I don't seem to find something there.
我浏览了ThisWorkBook的所有属性,我似乎没有找到那里的东西。
MsgBox ActiveWorkbook.BuiltinDocumentProperties("Creation Date")
'Output: 25.07.2011 14:51:11
This works for Excel 2003, don't have 2010 to test it. 这适用于Excel 2003,没有2010测试它。 Link to MSDN Doc for Office 2010, there is a list with other available properties on there, too.
链接到MSDN Doc for Office 2010,还有一个列表,其中包含其他可用属性。
Use Scripting.FileSystemObject 使用Scripting.FileSystemObject
Dim oFS As Object
Dim creationDate As String
Set oFS = CreateObject("Scripting.FileSystemObject")
creationDate = oFS.GetFile(ThisWorkbook.FullName).DateCreated
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
I found that FileDateTime works best. 我发现FileDateTime效果最好。
FileDateTime (application.activeworkbook.path)
Tech on the net says it applies to Excel 2016, 2013, 2011 for Mac, 2010, 2007, 2003, XP, and 2000 Tech on the net表示它适用于Excel 2016,2013,2011适用于Mac,2010,2007,2003,XP和2000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.