![]() |
GetAttr giving unexpected results
I have a code that creates a list of all the files and
subfolders in a directory. It's been working fine, but all of a sudden, GetAttr of a file ("T:\Janelle\TestFolder\Original\79017499.xls") is giving a result of 2080 instead of the expected result of no more than 127. Has anybody ever seen this sort of thing before? What's going on here? |
GetAttr giving unexpected results
The 2000 indicates the file is compressed (in a compressed folder).
-- Jim Rech Excel MVP |
GetAttr giving unexpected results
I meant 2048 = compressed.
This is the full list of attribute code as far as I know. It doesn't look as if VB help has been updated in a while. -- Jim Rech Excel MVP FILE_ATTRIBUTE_READONLY 1 FILE_ATTRIBUTE_HIDDEN 2 FILE_ATTRIBUTE_SYSTEM 4 FILE_ATTRIBUTE_DIRECTORY 16 FILE_ATTRIBUTE_ARCHIVE 32 FILE_ATTRIBUTE_DEVICE 64 FILE_ATTRIBUTE_NORMAL 128 FILE_ATTRIBUTE_TEMPORARY 256 FILE_ATTRIBUTE_SPARSE_FILE 512 FILE_ATTRIBUTE_REPARSE_POINT 1024 FILE_ATTRIBUTE_COMPRESSED 2048 FILE_ATTRIBUTE_OFFLINE 4096 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 8192 FILE_ATTRIBUTE_ENCRYPTED 16384 |
GetAttr giving unexpected results
Wow, thanks! That's certainly a lot more attributes than
either the help files or the Object Browser shows! One question, though. The VBA VbFileAttribute class has a constant called vbNormal = 0. How is that different from the FILE_ATTRIBUTE_NORMAL = 128 that you listed? -----Original Message----- I meant 2048 = compressed. This is the full list of attribute code as far as I know. It doesn't look as if VB help has been updated in a while. -- Jim Rech Excel MVP FILE_ATTRIBUTE_READONLY 1 FILE_ATTRIBUTE_HIDDEN 2 FILE_ATTRIBUTE_SYSTEM 4 FILE_ATTRIBUTE_DIRECTORY 16 FILE_ATTRIBUTE_ARCHIVE 32 FILE_ATTRIBUTE_DEVICE 64 FILE_ATTRIBUTE_NORMAL 128 FILE_ATTRIBUTE_TEMPORARY 256 FILE_ATTRIBUTE_SPARSE_FILE 512 FILE_ATTRIBUTE_REPARSE_POINT 1024 FILE_ATTRIBUTE_COMPRESSED 2048 FILE_ATTRIBUTE_OFFLINE 4096 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 8192 FILE_ATTRIBUTE_ENCRYPTED 16384 . |
GetAttr giving unexpected results
How is that different from the FILE_ATTRIBUTE_NORMAL = 128 that you
listed? They are the same. As far as I can tell the VB authors decided to convert the 128 that the Windows API call returns (that the VB GetAttrib function undoubtedly calls) from 128 to 0. You can run this to prove that. You may find other differences for all I know. Declare Function GetFileAttributes Lib "kernel32.dll" Alias "GetFileAttributesA" ( _ ByVal lpFileName As String) As Long Sub VBA() MsgBox GetAttr("C:\FileWithNoAttributes.xls") End Sub Sub WindowsAPI() MsgBox GetFileAttributes("C:\FileWithNoAttributes.xls") End Sub -- Jim Rech Excel MVP |
All times are GMT +1. The time now is 05:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com