Bonjour à tous,
J'ai cette fonction qui recupere tous les fichiers d'un répertoire avec un préfixe définit:
"
Public nwbk As Workbook
Public awbk As Workbook
Public Function listeFichiers()
Dim RepFilePointRevue As String
Dim Liste As Variant
Dim prefix As String, cpath As String
Set awbk = Application.ActiveWorkbook
Set nwbk = Application.Workbooks.Add
prefix = "Point Revue-projet-DQI_"
cpath = awbk.Path & "\"
RepFilePointRevue = cpath & prefix & "*"
Liste = GetFileList(RepFilePointRevue)
End Function
"
et
"
Function GetFileList(FileSpec As String) As Variant
' Returns an array of filenames that match FileSpec. ' if no matching files are found, it returns false
Dim Filecount As Integer
Dim Filename As String
'On Error Goto NoFilesFound Filecount = 0
Filename = Dir(FileSpec)
If Filename = "" Then GoTo NoFilesFound
' loop until no more matching files are found
Do While Filename <> ""
Filecount = Filecount + 1
ReDim Preserve Filearray(1 To Filecount)
Filearray(Filecount) = Filename
Filename = Dir()
Loop
GetFileList = Filearray
Exit Function ' Error handler
NoFilesFound:
GetFileList = False
End Function
"
--------------------------------------------------------
Voici un listing des fichiers ramenés par ces fonctions présents dans Liste:
Point Revue-projet-DQI_AF_2006_10_30.xls
Point Revue-projet-DQI_AF_2006_11_06.xls
Point Revue-projet-DQI_JH_2006_11_06.xls
Point Revue-projet-DQI_TF_2006_10_30.xls
Point Revue-projet-DQI_TF_2006_11_06.xls
Point Revue-projet-DQI_Synthèse_2006_11_06.xls
-----------------------------------------------------------
1er point:
Comment faire pour ne pas sélectionner les fichiers contenant le mot "Synthèse"?
2ème point:
Les 2 lettres qui suivent "Point Revue-projet-DQI_" (AF, JH, TF ...) correspondent à des personnes.
Je souhaiterai que pour chaque personne, ne garder que le fichier le plus récent donc pour AF n'avoir dans Liste que Point Revue-projet-DQI_AF_2006_11_06.xls
et donc je souhaiterais que Liste ne contienne que:
Point Revue-projet-DQI_AF_2006_11_06.xls
Point Revue-projet-DQI_JH_2006_11_06.xls
Point Revue-projet-DQI_TF_2006_11_06.xls
Comment faire????
Merci de votre aide
J'ai cette fonction qui recupere tous les fichiers d'un répertoire avec un préfixe définit:
"
Public nwbk As Workbook
Public awbk As Workbook
Public Function listeFichiers()
Dim RepFilePointRevue As String
Dim Liste As Variant
Dim prefix As String, cpath As String
Set awbk = Application.ActiveWorkbook
Set nwbk = Application.Workbooks.Add
prefix = "Point Revue-projet-DQI_"
cpath = awbk.Path & "\"
RepFilePointRevue = cpath & prefix & "*"
Liste = GetFileList(RepFilePointRevue)
End Function
"
et
"
Function GetFileList(FileSpec As String) As Variant
' Returns an array of filenames that match FileSpec. ' if no matching files are found, it returns false
Dim Filecount As Integer
Dim Filename As String
'On Error Goto NoFilesFound Filecount = 0
Filename = Dir(FileSpec)
If Filename = "" Then GoTo NoFilesFound
' loop until no more matching files are found
Do While Filename <> ""
Filecount = Filecount + 1
ReDim Preserve Filearray(1 To Filecount)
Filearray(Filecount) = Filename
Filename = Dir()
Loop
GetFileList = Filearray
Exit Function ' Error handler
NoFilesFound:
GetFileList = False
End Function
"
--------------------------------------------------------
Voici un listing des fichiers ramenés par ces fonctions présents dans Liste:
Point Revue-projet-DQI_AF_2006_10_30.xls
Point Revue-projet-DQI_AF_2006_11_06.xls
Point Revue-projet-DQI_JH_2006_11_06.xls
Point Revue-projet-DQI_TF_2006_10_30.xls
Point Revue-projet-DQI_TF_2006_11_06.xls
Point Revue-projet-DQI_Synthèse_2006_11_06.xls
-----------------------------------------------------------
1er point:
Comment faire pour ne pas sélectionner les fichiers contenant le mot "Synthèse"?
2ème point:
Les 2 lettres qui suivent "Point Revue-projet-DQI_" (AF, JH, TF ...) correspondent à des personnes.
Je souhaiterai que pour chaque personne, ne garder que le fichier le plus récent donc pour AF n'avoir dans Liste que Point Revue-projet-DQI_AF_2006_11_06.xls
et donc je souhaiterais que Liste ne contienne que:
Point Revue-projet-DQI_AF_2006_11_06.xls
Point Revue-projet-DQI_JH_2006_11_06.xls
Point Revue-projet-DQI_TF_2006_11_06.xls
Comment faire????
Merci de votre aide