实时错误 429 activeX部件不能创建对象
这是ayusay(阿于)编的获得文件属性的代码,包括文件创建时间,大小等信息,在我机器上运行时,出现“实时错误 429 activeX部件不能创建对象”。本程序就是想找到文件的创建时间。
Private Sub Command1_Click()
Dim i As String, j As String
i = "c:\abc.txt"
Dim fso As Object
Dim fil As Object
Set fso = CreateObject("Scripting.FileSystemObject")'出现“实时错误 429 activeX部件不能创建对象”
Set fil = fso.GetFile(i)
With fil
Debug.Print "文件名:" & .Name
Debug.Print "文件" & .Name & "的大小:" & .Size
Debug.Print "文件" & .Name & "的类型:" & .Type
Debug.Print "文件" & .Name & "的建立日期:" & .DateCreated
Debug.Print "文件" & .Name & "的最后访问日期:" & .DateLastAccessed
Debug.Print "文件" & .Name & "的最后修改日期:" & .DateLastModified
Debug.Print "文件" & .Name & "所在驱动器:" & .Drive
Debug.Print "文件" & .Name & "所在文件夹:" & .ParentFolder
Debug.Print "文件" & .Name & "文件名(不支持长文件名):" & .ShortName
Debug.Print "文件" & .Name & "完整路径(支持长文件名):" & .Path
Debug.Print "文件" & .Name & "完整路径(不支持长文件名):" & .ShortPath
End With
End Sub
上次发了个帖,得到了Tiger_Zhao,和阿勇的帮忙,想给两位加分的,但因为我操作失误,没加上分,在此向二位表示感谢和歉意。