File Properties

Kenln

Registered User.
Local time
Today, 06:40
Joined
Oct 11, 2006
Messages
551
I am not sure how to word this.

In 'MS Windows Explorer' if you right click one can view a files properties. Under the 'Summary' tab most programs have a space for version.

Does any know of a way to fill this in programmatically? The other field would be nice too if possible.

Thank you,
 
I've not got the time right now to look into it in more detail, but I'd suggest that the the FileSystemObject would probably be worth exploring as a likely candidate for updating this programatically.
 
Yep, set a reference to Microsoft Scripting Runtime and then look into the FILE object. It has all of the properties like that.
 
This is what I have so far
http://support.microsoft.com/kb/189751

Cannot return the file version number - the File object in the Files collection of the FileSystemObject can return several file properties. However, there is no version property. Use the GetFileVersionInfo Windows API function to get a file's version information.

I found this but... I think I'm outside my league
http://msdn2.microsoft.com/en-us/library/ms647003.aspx

I'll keep looking, if you find anything please let me know.
 
I thing the properties like this in the FSO are read only
 
I've tried revision, version, revnum, revisionnumber.

I can't seem to locate the right property name if it is there.
 
oops,
left out code,

Code:
Sub ShowFileAccessInfo()

Dim filespec As String
    filespec = "C:\junk\test.txt"
    Dim fs, d, f, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filespec)
    s = UCase(f.Path) & vbCrLf
    s = s & "Created: " & f.DateCreated & vbCrLf
    s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
    s = s & "Last Modified: " & f.DateLastModified & vbCrLf
    s = s & "Revision: " & f.RevisionNumber & vbCrLf

    MsgBox s, 0, "File Access Info"
End Sub
 
You should use early binding as bob suggested. This way you will be able to use intellsense
 
I know what early binding is but...
Could you help with that
 
sure just set a reference to the Microsoft Scripting Runtime
 
To use early binding just set a reference as Keith has said and change it to:
Code:
Sub ShowFileAccessInfo()

Dim filespec As String
    filespec = "C:\junk\test.txt"
    Dim fs As FileSystemObject, d As Directory, f as File, s As String
    Set fs = New FileSystemObject
    Set f = fs.GetFile(filespec)
    s = UCase(f.Path) & vbCrLf
    s = s & "Created: " & f.DateCreated & vbCrLf
    s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
    s = s & "Last Modified: " & f.DateLastModified & vbCrLf
    s = s & "Revision: " & f.RevisionNumber & vbCrLf

    MsgBox s, 0, "File Access Info"
End Sub
 
But the version and revision isn't going to be available from what I've seen in the article you posted.

You would need to use the GetFileVersionInfo API and there is another one you would need in association with it. Don't have time to sort it now.
 

Users who are viewing this thread

Back
Top Bottom