bonsoir le forum
excel 2007 ne prend pas la fonction: With Application.FileSearch
malgres les explications que je trouve ne suis pas assez expert en vb pour modifier mon petit programme que voici:
(merci si quelqu'un m'aide à faire les bonnes modifications)
With Application.FileSearch
.NewSearch
.LookIn = Workbooks("programme2.xls").Sheets("d").Range("B2").Value
.SearchSubFolders = True
.Filename = "FICHE*" 'valeursaisi
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
MsgBox "Affaire en cours, il y a " & .FoundFiles.Count & " fichiers dans ce repertoire."
Workbooks("programme2.xls").Sheets("d").Range("DD50").Value = "ok"
Else
reponse = MsgBox("OK pour rajouter fiche pieuvre, pieuvre sg et fiche élements dans rep : " & Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("C2").Value, vbYesNo)
'MsgBox "OK pour rajouter fiche pieuvre, pieuvre sg et fiche élements dans rep : " & Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("C2").Value
If reponse = vbNo Then Exit Sub
SourceFile = Workbooks("programme2.xls").Sheets("d").Range("B1").Value & Workbooks("programme2.xls").Sheets("d").Range("C1").Value
DestinationFile = Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("C2").Value
FileCopy SourceFile, DestinationFile
SourceFile = Workbooks("programme2.xls").Sheets("d").Range("B1").Value & Workbooks("programme2.xls").Sheets("d").Range("D1").Value
DestinationFile = Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("D2").Value
FileCopy SourceFile, DestinationFile
SourceFile = Workbooks("programme2.xls").Sheets("d").Range("B1").Value & Workbooks("programme2.xls").Sheets("d").Range("E1").Value
DestinationFile = Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("E2").Value
FileCopy SourceFile, DestinationFile
Workbooks("programme2.xls").Sheets("d").Range("DD50").Value = "ok"
End If
End With
excel 2007 ne prend pas la fonction: With Application.FileSearch
malgres les explications que je trouve ne suis pas assez expert en vb pour modifier mon petit programme que voici:
(merci si quelqu'un m'aide à faire les bonnes modifications)
With Application.FileSearch
.NewSearch
.LookIn = Workbooks("programme2.xls").Sheets("d").Range("B2").Value
.SearchSubFolders = True
.Filename = "FICHE*" 'valeursaisi
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
MsgBox "Affaire en cours, il y a " & .FoundFiles.Count & " fichiers dans ce repertoire."
Workbooks("programme2.xls").Sheets("d").Range("DD50").Value = "ok"
Else
reponse = MsgBox("OK pour rajouter fiche pieuvre, pieuvre sg et fiche élements dans rep : " & Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("C2").Value, vbYesNo)
'MsgBox "OK pour rajouter fiche pieuvre, pieuvre sg et fiche élements dans rep : " & Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("C2").Value
If reponse = vbNo Then Exit Sub
SourceFile = Workbooks("programme2.xls").Sheets("d").Range("B1").Value & Workbooks("programme2.xls").Sheets("d").Range("C1").Value
DestinationFile = Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("C2").Value
FileCopy SourceFile, DestinationFile
SourceFile = Workbooks("programme2.xls").Sheets("d").Range("B1").Value & Workbooks("programme2.xls").Sheets("d").Range("D1").Value
DestinationFile = Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("D2").Value
FileCopy SourceFile, DestinationFile
SourceFile = Workbooks("programme2.xls").Sheets("d").Range("B1").Value & Workbooks("programme2.xls").Sheets("d").Range("E1").Value
DestinationFile = Workbooks("programme2.xls").Sheets("d").Range("B2").Value & Workbooks("programme2.xls").Sheets("d").Range("E2").Value
FileCopy SourceFile, DestinationFile
Workbooks("programme2.xls").Sheets("d").Range("DD50").Value = "ok"
End If
End With