Hi,
Is there anyway to use the "SetAttr" statement to change the attributes using "*.*"?
Please advice.
Printable View
Hi,
Is there anyway to use the "SetAttr" statement to change the attributes using "*.*"?
Please advice.
You could write your own Wrapper Sub which has the Extended Capability of handling WildCards, ie.
Usage:Code:Public Sub SetAttrEx(ByVal PathName As String, ByVal Attributes As VbFileAttribute)
Dim sDir As String
Dim sPath As String
Dim iPos As Integer
While InStr(iPos + 1, PathName, "\")
iPos = InStr(iPos + 1, PathName, "\")
Wend
If iPos Then
sPath = Left$(PathName, iPos)
Else
sPath = PathName
End If
sDir = Dir(PathName)
While Len(sDir)
If (GetAttr(sPath & sDir) And vbDirectory) <> vbDirectory Then
Call SetAttr(sPath & sDir, Attributes)
End If
sDir = Dir
Wend
End Sub
Same as SetAttr() but can also handle Wild Cards, ie.
Call SetAttr("C:\Files\*.txt", vbReadOnly)
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Thank you very much for your reply.
Regards