bcooler
Programmer
- Jun 13, 2009
- 132
Hello all-
I've been using XP until I was recently converted over to Windows 7. I have been very successful with Allen Browne's solution for obtaining file properties (until now):
[link]http://allenbrowne.com/ser-59alt.html[/url]
I've added a little code to this and will give it below.
Now I'm running into some problems because of 2 issues:
1.) The new computer had a Windows setting that said to "hide known file extensions". Until I turned that off, the following code would not work:
because "objFolder.GetDetailsOf(strFilename, 0)" is just a screen name, not a file name (no extension). That made me realize I have code that depends on a user's preferences.....ehhh. How do I make a solution that does not care what a user's settings are?
2.) I have another issue finding the correct file properties because different Windows OS have different locations for these properties (please see bottom of a related article www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=160880&page=1).
One idea I had was to map to the correct locations depending on the Windows OS. Any ideas on how to get OS info with VBA? Please note, I'm about a 5 out of 10 on VBA, but know nothing of most other languages).
Thanks!
Brian
I've been using XP until I was recently converted over to Windows 7. I have been very successful with Allen Browne's solution for obtaining file properties (until now):
[link]http://allenbrowne.com/ser-59alt.html[/url]
I've added a little code to this and will give it below.
Now I'm running into some problems because of 2 issues:
1.) The new computer had a Windows setting that said to "hide known file extensions". Until I turned that off, the following code would not work:
Code:
For Each strFilename In objFolder.Items
If objFolder.GetDetailsOf(strFilename, 0) = strTemp Then 'strTemp is a filename (with extension)
arrHeaders(0) = strPath & strTemp 'file path
arrHeaders(1) = objFolder.GetDetailsOf(strFilename, 0) 'file name
arrHeaders(2) = objFolder.GetDetailsOf(strFilename, 10) 'title
arrHeaders(3) = objFolder.GetDetailsOf(strFilename, 12) 'Category (using as 'AS9100 Keywords')
arrHeaders(4) = objFolder.GetDetailsOf(strFilename, 14) 'Comments (using as 'Expiration Date')
arrHeaders(5) = objFolder.GetDetailsOf(strFilename, 9) 'Author
s = " INSERT INTO tblFileProp " & "(FilePath, FileName, Title, AS9100, Comments, Author) VALUES " _
& "(""" & arrHeaders(0) & """,""" & arrHeaders(1) & """,""" & arrHeaders(2) & """,""" & arrHeaders(3) & """,""" & arrHeaders(4) & """,""" & arrHeaders(5) & """)"
db.Execute s, dbFailOnError
Exit For
End If
Next
because "objFolder.GetDetailsOf(strFilename, 0)" is just a screen name, not a file name (no extension). That made me realize I have code that depends on a user's preferences.....ehhh. How do I make a solution that does not care what a user's settings are?
2.) I have another issue finding the correct file properties because different Windows OS have different locations for these properties (please see bottom of a related article www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=160880&page=1).
One idea I had was to map to the correct locations depending on the Windows OS. Any ideas on how to get OS info with VBA? Please note, I'm about a 5 out of 10 on VBA, but know nothing of most other languages).
Thanks!
Brian