跳到主要內容

獲取並在單元格中插入創建時間和上次修改時間

本文將討論如何獲取當前工作簿信息的創建時間和最後修改時間,以及在Excel的單元格中插入當前工作簿信息的創建時間和最後修改時間的方法。

使用Info命令獲取Excel中的創建時間和上次修改時間

使用高級屬性功能獲取Excel中的創建時間和上次修改時間

使用VBA代碼在Excel的單元格中插入創建時間和上次修改時間

使用Kutools for Excel在單元格/頁眉/頁腳中插入創建的時間和最後修改的時間 好主意3


箭頭藍色右氣泡 使用Info命令獲取Excel中的創建時間和上次修改時間

我們可以在Microsoft Excel 2010/2013的後台視圖中找到當前工作簿的確切創建時間和上次修改時間。

點擊 文件 > 聯繫我們 ,並在後台視圖的右側顯示 相關日期 信息。 在下面 相關日期 標題,它列出了最後修改時間,創建時間和最後打印時間。 請參閱以下屏幕截圖:

-2

 

注意: 此方法僅在Microsoft Excel 2010/2013中可用。 在Excel 2007中無效。


箭頭藍色右氣泡使用高級屬性功能獲取Excel中的創建時間和上次修改時間

實際上,我們可以在“文檔屬性”對話框中獲得當前工作簿的創建時間和上次修改時間。
步驟 1: 打開 進階屬性 對話框:

在Excel 2007中,單擊 Office 按鈕> Prepare > 氟化鈉性能文檔屬性 欄將顯示在工具欄下方,單擊 文檔屬性 > 進階屬性,請參見屏幕截圖:

文檔插入修改時間 3-3
-1
文檔插入修改時間 4-4

 

在Excel 2010/2013中,點擊 文件 > 聯繫我們 > 氟化鈉性能 > 進階屬性.

文檔插入修改時間 4-4

步驟 2: 在裡面 進階屬性 對話框中,您將在“統計信息”選項卡下看到創建時間和上次修改時間。 請參見以下屏幕截圖:

文檔插入修改時間 4-4


箭頭藍色右氣泡 使用VBA代碼在Excel的單元格中插入創建時間和上次修改時間

以下VBA宏將幫助您將當前工作簿信息的創建時間和上次修改時間直接插入單元格中。

在Excel中插入創建時間和上次修改時間

步驟 1:按住 ALT + F11 鍵,並打開“ Microsoft Visual Basic應用程序”窗口。

步驟 2:點擊 插入 >> 模塊,然後將以下宏粘貼到“模塊窗口”中。

VBA代碼:在Excel中插入創建時間和上次修改時間

Sub Workbook_Open()
Range("A1").Value = Format(ThisWorkbook.BuiltinDocumentProperties("Creation Date"), "short date")
Range("A2").Value = Format(ThisWorkbook.BuiltinDocumentProperties("Last Save Time"), "short date")
End Sub

步驟 3:按 F5 運行此宏的鍵。 然後,創建日期和最後修改日期將分別插入到單元格A1和單元格A2中。

備註:您可以根據需要修改VB中的目標單元格。

在Excel中插入工作簿的上次修改時間

步驟 1:按住 ALT + F11 鍵,並打開“ Microsoft Visual Basic應用程序”窗口。

步驟 2:點擊 插入 >> 模塊,然後將以下宏粘貼到“模塊窗口”中。

Public Function ModDate()
ModDate = Format(FileDateTime(ThisWorkbook.FullName), "m/d/yy h:n ampm")
End Function

步驟 3:然後保存並關閉此代碼,然後返回工作表的空白單元格中,輸入公式 = ModDate(),然後按 Enter 鍵。 然後將最後修改的時間插入到單元格中。

-2

在Excel中插入工作簿的創建時間

步驟 1:按住 ALT + F11 鍵,並打開“ Microsoft Visual Basic應用程序”窗口。

步驟 2:點擊 插入 >> 模塊,然後將以下宏粘貼到“模塊窗口”中。

Function CreateDate() As Date
CreateDate = ActiveWorkbook.BuiltinDocumentProperties("Creation Date")
End Function

步驟 3:保存並關閉此代碼,返回工作表,在空白單元格中輸入公式 = CreateDate(),然後按 Enter 鍵。創建的日期將被插入到單元格中,如以下屏幕截圖所示:

-2

注意: 如果您的單元格不是日期格式,則可能會顯示一個奇怪的數字。 只需將此單元格格式化為 日期 格式,它將顯示為正常日期。


箭頭藍色右氣泡 使用Kutools for Excel在單元格/頁眉/頁腳中插入創建的時間和最後修改的時間

我可以為您介紹一個方便的工具-Excel的Kutools 其中300多個有用功能可以提高您的工作效率? 與它 插入工作簿信息 功能,您可以快速將工作簿路徑,工作簿/工作表名稱,用戶名或創建時間以及上次修改時間插入到單元格或頁眉或頁腳中。

Excel的Kutools, 與以上 300 方便的功能,使您的工作更加輕鬆。 

免費安裝 Kutools for Excel,請執行以下操作:

1。 點擊 Kutools 加 > 工作簿 > 插入工作簿信息。 看截圖:
doc最後修改name2

2.然後在 插入工作簿信息 對話框中,從“信息”部分檢查要插入的信息,然後指定要插入的位置,您可以選擇單元格,頁腳(左頁腳,中間頁腳,右頁腳)或頁眉(左頁眉,中間頁眉,正確的標題)。 看截圖:
doc插入文件創建的修改時間1

3。 點擊 Ok,並且您檢查的信息已插入到您指定的位置。

小費。 如果您想免費試用“插入工作簿信息”功能, 請免費下載Kutools for Excel 首先,然後按照上述步驟進行操作。

箭頭藍色右氣泡 插入工作簿信息


最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (21)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I LOOOOOOOOVE YOU!!!! TKSSSSSSS
This comment was minimized by the moderator on the site
I want to automatically create a space between each customer in excel how do i do this??
This comment was minimized by the moderator on the site
Hi Team, I need your help. I am having an excel file, there i want to find the modified date of a particular cell. Please help me with the coding here, if possible. Thanks in advance.
This comment was minimized by the moderator on the site
I learned why "Last Save Time" was not working for me. I put my function in my .XLA file, and "ThisWorkbook" was referring to the .XLA file itself. Therefore I needed to get Application.ActiveWorkbook (presumably the location of the function call), ending up with: Function DocumentProperty(PropertyName As String) ' 'You can refer to document properties either by index value or by name. The following list shows the available built-in document property names: '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) Call Application.Volatile(True) Dim ActiveUserWorkbook On Error Resume Next Set ActiveUserWorkbook = Application.ActiveWorkbook If Err.Number 0 Then DocumentProperty = "!!! Error getting Application.ActiveWorkbook: " & Err.Description Exit Function End If DocumentProperty = ActiveUserWorkbook.BuiltinDocumentProperties(PropertyName) If Err.Number 0 Then DocumentProperty = "!!! Unknown Property Name !!!" Exit Function End If End Function
This comment was minimized by the moderator on the site
I see that "Last Save Time" is only referenced ONCE in the code. I'm using Excel 2010.When I put "Last Save Time" into a function, even with Application.Volatile(true), the value never updates. Then I noticed that the value returned by "Last Save Time" does not appear in the Excel 2010 "Properties" page NOR any of the tabs in the "Advanced Properties" dialog. Could "Last Save Time" be some relic?
This comment was minimized by the moderator on the site
Thanks for the help, but I also had a problem with the cell not updating after a save without having to first close and reopen the workbook. I added the following code to the workbook which refreshes after a save event: Private Sub Workbook_AfterSave(ByVal Success As Boolean) If Success Then ActiveSheet.Calculate End If End Sub That did the trick for me. Hope it helps.
This comment was minimized by the moderator on the site
Could this be modified to display the Created Date of other closed files? I'd like to compare the Created Date of a file on my Desktop to a file on a public web server. I could create the formula to use your functions...CreateDate() of local file to CreateDate() of web file...and alert me to a change. I appreciate your help. Bruce
This comment was minimized by the moderator on the site
very very very very very very very very helpful thanks
This comment was minimized by the moderator on the site
Hiya Love love love this but sadly the date only is appearing in USA and in Australia we have dd/mm/yy I've tired changing it to this format using the "Date" section but have not had any luck. Any ideas?
This comment was minimized by the moderator on the site
Julie - in the VBA code use "dd/mm/yy hh:n" instead. That'll put the date in the "right" order! :lol:
This comment was minimized by the moderator on the site
Hey this was awesome. Is it possible to insert the created date and last modified date of a different workbook? I'm looking to create an index file that tells me when other documents were last updated. Thanks!!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations