[英]Excel 2010 VBA creation date
如何在excel 2010中使用VBA獲取當前工作簿文件創建日期? 我瀏覽了ThisWorkBook的所有屬性,我似乎沒有找到那里的東西。
MsgBox ActiveWorkbook.BuiltinDocumentProperties("Creation Date")
'Output: 25.07.2011 14:51:11
這適用於Excel 2003,沒有2010測試它。 鏈接到MSDN Doc for Office 2010,還有一個列表,其中包含其他可用屬性。
Dim oFS As Object
Dim creationDate As String
Set oFS = CreateObject("Scripting.FileSystemObject")
creationDate = oFS.GetFile(ThisWorkbook.FullName).DateCreated
使用
ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date").Value
要列出所有屬性,請運行此宏
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
我發現FileDateTime效果最好。
FileDateTime (application.activeworkbook.path)
Tech on the net表示它適用於Excel 2016,2013,2011適用於Mac,2010,2007,2003,XP和2000
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.