跳到主要内容

获取并在单元格中插入创建时间和上次修改时间

本文将讨论获取当前工作簿信息的创建时间和最后修改时间,以及在Excel的单元格中插入当前工作簿信息的创建时间和最后修改时间的方法。

使用Info命令获取Excel中的创建时间和上次修改时间

使用高级属性功能获取Excel中的创建时间和上次修改时间

使用VBA代码在Excel的单元格中插入创建时间和上次修改时间

使用 Kutools for Excel 在单元格/页眉/页脚中插入创建时间和上次修改时间 好主意3


箭头蓝色右气泡 使用Info命令获取Excel中的创建时间和上次修改时间

我们可以在Microsoft Excel 2010/2013的后台视图中找到当前工作簿的确切创建时间和上次修改时间。

点击 文件 > 资料包,并在后台视图的右侧显示 相关日期 信息。 在下面 相关日期 标题,它列出了上次修改时间,创建时间和上次打印时间。 请参阅以下屏幕截图:

-2

 

请注意: 此方法仅在Microsoft Excel 2010/2013中可用。 在Excel 2007中无效。


箭头蓝色右气泡使用高级属性功能获取Excel中的创建时间和上次修改时间

实际上,我们可以在“文档属性”对话框中获取当前工作簿的创建时间和上次修改时间。
: 打开 进阶属性 对话框:

在Excel 2007中,单击 公司联络号码 按钮> Prepare > 查看房源和一个 文档属性 栏将显示在工具栏下方,单击 文档属性 > 进阶属性,请参见屏幕截图:

文档插入修改时间 3-3
-1
文档插入修改时间 4-4

 

在Excel 2010/2013中,点击 文件 > 资料包 > 查看房源 > 进阶属性.

文档插入修改时间 4-4

: 在里面 进阶属性 对话框中,您将在“统计信息”选项卡下看到创建时间和上次修改时间。 请参见以下屏幕截图:

文档插入修改时间 4-4


箭头蓝色右气泡 使用VBA代码在Excel的单元格中插入创建时间和上次修改时间

以下VBA宏将帮助您将当前工作簿信息的创建时间和上次修改时间直接插入单元格中。

在Excel中插入创建时间和上次修改时间

:按住 ALT + F11 键,并打开“ Microsoft Visual Basic应用程序”窗口。

:点击 插页 >> 模块,然后将以下宏粘贴到“模块窗口”中。

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

:按 F5 运行此宏的键。 然后,创建日期和最后修改日期将分别插入到单元格A1和单元格A2中。

备注:您可以根据需要修改VB中的目标单元格。

在Excel中插入工作簿的上次修改时间

:按住 ALT + F11 键,并打开“ Microsoft Visual Basic应用程序”窗口。

:点击 插页 >> 模块,然后将以下宏粘贴到“模块窗口”中。

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

:然后保存并关闭此代码,然后返回工作表,在空白单元格中输入公式 = ModDate(),然后按 输入 键。 然后将最后修改的时间插入单元格中。

-2

在Excel中插入工作簿的创建时间

:按住 ALT + F11 键,并打开“ Microsoft Visual Basic应用程序”窗口。

:点击 插页 >> 模块,然后将以下宏粘贴到“模块窗口”中。

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

:保存并关闭此代码,返回工作表,在空白单元格中输入公式 = CreateDate(),然后按 输入 键。创建的日期将被插入到单元格中,如以下屏幕截图所示:

-2

请注意: 如果您的单元格不是日期格式,则可能会显示一个奇怪的数字。 只需将此单元格格式化为 日期 格式,它将显示为正常日期。


箭头蓝色右气泡 使用 Kutools for Excel 在单元格/页眉/页脚中插入创建时间和上次修改时间

我可以为您介绍一个方便的工具-Kutools for Excel 其中300多个有用功能可以提高您的工作效率? 与它 插入工作簿信息 功能,您可以快速将工作簿路径,工作簿/工作表名称,用户名或创建时间以及上次修改时间插入到单元格或页眉或页脚中。

Kutools for Excel, 与超过 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 Tab 为 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