Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default GetAttr giving unexpected results

The 2000 indicates the file is compressed (in a compressed folder).

--
Jim Rech
Excel MVP


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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


.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumif? ... Unexpected Results? Ken Excel Discussion (Misc queries) 3 July 23rd 09 12:41 AM
lookup formula unexpected results David Ryan Excel Worksheet Functions 1 May 14th 09 03:56 AM
lookup formula unexpected results David Ryan Excel Worksheet Functions 3 May 14th 09 03:28 AM
UNexpected NPER results JR Hester Excel Discussion (Misc queries) 4 May 26th 08 07:50 PM
Equation giving unexpected results Mike K Charts and Charting in Excel 2 January 27th 05 02:58 PM


All times are GMT +1. The time now is 09:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"