View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
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