Nepumuk hat Code geschrieben um FileSearch in XL2007 zu ersetzen.
Nun wollte ich den benutzen, aber das Klassenmodul dazu "clsFileSearch" in der personl.xlmb unterbringen um es in allen Mappen benutzen zu können. Wie mache ich das?
Nachstehend der Code der in die Mappe in ein Standardmodul gehört.
Danke ^ Gruß
Reinhard
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
'// Module : Modul1, Modul
'// Author : NEPUMUK at http:// _
www.office-loesung.de/ftopic148247_0_0_asc.php
'// Created : 28. Mai 2007
'// Modified :
'// Purpose : FileSearch
Option Explicit
Public objFileSearch As clsFileSearch
'Public Enum SORT_BY
Sort_by_None
Sort_by_Name
Sort_by_Path
Sort_by_Size
Sort_by_Last_Access
Sort_by_Last_Modyfy
Sort_by_Date_Create
End Enum
Public Enum SORT_ORDER
Sort_Order_Ascending
Sort_Order_Descending
End Enum
Public Type FILEINFO
strFilename As String
strPath As String
lngSize As Long
dmtLastAccess As Date
dmtLastModify As Date
dmtDateCreate As Date
End Type
Public Sub Test()
Dim objFileSearch As clsFileSearch, lngIndex As Long
Set objFileSearch = New clsFileSearch
With objFileSearch
.CaseSenstiv = True
.Extension = "*.xls*"
.FolderPath = "c:\test"
.SearchLike = "*"
.SubFolders = False
If .Execute(Sort_by_Name, Sort_Order_Ascending) > 0 Then
MsgBox "There were " & .FileCount & " file(s) found."
For lngIndex = 1 To .FileCount
MsgBox .Files(lngIndex).strFilename
Next lngIndex
Else
MsgBox "There were no files found."
End If
End With
Set objFileSearch = Nothing
End Sub