VBA 从文本文件的属性中获取日期 [英] VBA Getting date from properties of a text file

查看:99
本文介绍了VBA 从文本文件的属性中获取日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取特定文本文件上传到计算机的日期.日期不在实际的文本文件中,您必须右键单击然后转到属性以查看日期.我需要将日期读入一个变量.

I'm trying to grab the date that a specific text file was uploaded onto the computer. The date isn't in the actual text file, instead you have to right-click then go to properties to view the date. I need to read the date into a variable.

我不知道从哪里开始尝试完成这项工作.

I have no idea where to start to try and get this done.

谢谢,

杰西·斯莫瑟蒙

推荐答案

如果内置的 FileDateTime() 不是您可以使用 FSO 后的内容:

If the built in FileDateTime() isnt what your after you can use the FSO:

Dim FSO As Object: Set FSO = CreateObject("Scripting.FileSystemObject")
Dim objFile As Object: Set objFile = FSO.Getfile("C:\bleep\bloop.file")

Debug.Print "Date created: " & objFile.DateCreated
Debug.Print "Date last accessed: " & objFile.DateLastAccessed
Debug.Print "Date last modified: " & objFile.DateLastModified

如果它是扩展属性中的日期,请检查这个.

If its a date in an extended attribute check this out.

这篇关于VBA 从文本文件的属性中获取日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆