How do you get any file's last modified date using VB6?
+1
A:
You can use the FileSystemObject here's an example
You can also check out the MSDN documentation the samples are for scripting but they should be translatable to VB6 easily.
JoshBerke
2009-11-02 16:15:46
-1. I recommend avoiding FileSystemObject if possible. It's not always present on user machines. We had a helpdesk problem last month because a paranoid IT department had crippled FileSystemObject, and that broke some software we maintain. Also this can be done in one line in native VB6, not 4 lines of FileSystemObject.
MarkJ
2009-11-02 17:33:55
+1
A:
Add a reference to the Microsoft Scripting Runtime (Project->References...) and use the following code:
Dim fso As New FileSystemObject
Dim fil As File
Set fil = fso.GetFile("C:\foo.txt")
Debug.Print fil.DateLastModified
raven
2009-11-02 16:21:28
-1. I recommend avoiding FileSystemObject if possible. It's not always present on user machines. We had a helpdesk problem last month because a paranoid IT department had crippled FileSystemObject, and that broke some software we maintain. Also this can be done in one line in native VB6: must be better than 4 lines with FileSystemObject.
MarkJ
2009-11-02 17:34:25
+6
A:
There is a built in VB6 function for that - no need for FSO (although FSO is great for more advanced file operations)
From http://msdn.microsoft.com/en-us/library/aa262740%28VS.60%29.aspx
Dim MyStamp As Date
MyStamp = FileDateTime("C:\TESTFILE.txt")
DJ
2009-11-02 16:40:18
+1. I recommend avoiding FileSystemObject if possible. It's not always present on user machines. We had a helpdesk problem last month because a paranoid IT department had crippled FileSystemObject, and that broke some software we maintain. Here the native VB6 technique is one line, and the FSO code is at least 3 lines.
MarkJ
2009-11-02 17:32:37