Attribute von Dateien eines Verzeichnises umsetzen
26.02.2004 19:33:02
SteffenS
ich habe im Archiv folgendes Makro gefunden:
Option Explicit
Sub DateienOeffnen()
Dim arrFiles As Variant
Dim intCounter As Integer
Dim strPath As String
strPath = "c:\excel\support\daeppen\"
arrFiles = FileArray(strPath, "*.xls")
For intCounter = 1 To UBound(arrFiles)
SetAttr arrFiles(intCounter), vbNormal
'Workbooks.Open strPath & arrFiles(intCounter)
Next intCounter
End Sub
Private Function FileArray(strPath As String, strPattern As String)
Dim arrDateien()
Dim intCounter As Integer
Dim strDatei As String
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
strDatei = Dir(strPath & strPattern)
Do While strDatei <> ""
intCounter = intCounter + 1
ReDim Preserve arrDateien(1 To intCounter)
arrDateien(intCounter) = strDatei
strDatei = Dir()
Loop
FileArray = arrDateien
End Function
Diese habe ich mir so angepasst, dass bei allen Dateien außer der aktuellen des angebenen Verzeichnisse die Attribute auf normal gesetzt werden.
Dies geht aber nicht.
Was mache ich falsch?
Danke Euch schonmal
Steffen