VB Code:
' API Method Private Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long Private Const FILE_ATTRIBUTE_ARCHIVE = &H20 Private Const FILE_ATTRIBUTE_COMPRESSED = &H800 Private Const FILE_ATTRIBUTE_DIRECTORY = &H10 Private Const FILE_ATTRIBUTE_HIDDEN = &H2 Private Const FILE_ATTRIBUTE_NORMAL = &H80 Private Const FILE_ATTRIBUTE_READONLY = &H1 Private Const FILE_ATTRIBUTE_SYSTEM = &H4 Private Const FILE_ATTRIBUTE_TEMPORARY = &H100 ' Usage (This will set file to hidden) Dim File as String File = "Path of file" SetFileAttributes File, FILE_ATTRIBUTE_HIDDEN ' FSO Method (this examples set attributes of folder, but can be easily changed to a file) Dim FSO As New Scripting.FileSystemObject Dim F As Folder Set F = FSO.GetFolder(FDR) F.Attributes = Hidden Set F = Nothing Set FSO = Nothing


Reply With Quote