vb判断文本文件创建时间为最新?

vb怎样判断出程序目录下创建时间为最新的那个文本文件(txt文件)?

第1个回答  2013-03-30
参考一下吧
'工程-引用 “Microsoft Shell Controls And Automation”

Private Sub Command1_Click()
Dim oDLG
Dim pth As String
Dim Flname As String

Dim shl As Shell32.Shell
Dim shfd As Shell32.Folder
Dim s As String
Dim i As Integer
Set oDLG = CreateObject("MSComDlg.CommonDialog")
With oDLG
.DialogTitle = "打开文件"
.Filter = "所有文件|*.*"
.MaxFileSize = 255
.ShowOpen
If .FileName <> "" Then
i = InStrRev(.FileName, "\")
If i = 0 Then Exit Sub
Flname = Mid(.FileName, i + 1)
Set shl = New Shell
Set shfd = shl.NameSpace(Left(.FileName, i - 1))

For i = 0 To 39
If shfd.GetDetailsOf(0, i) <> "" And shfd.GetDetailsOf(shfd.Items.Item(Flname), i) <> "" Then
s = s & i & ":" & shfd.GetDetailsOf(0, i) & ": " & shfd.GetDetailsOf(shfd.Items.Item(Flname), i) & Chr(10)
End If
Next i
MsgBox s, vbInformation, "文件属性"
End If
End With
Set oDLG = Nothing
End Sub追问

还加什么部件?不打开文件夹行吗?

追答

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网