Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to save several files with a naming convention as follows:
"FilePrefix_###.xls", where the ### would be a number ranging from 1 to 999. The routine would search through a folder and determine if there were any other files named "FilePrefix_" and choose the next number in the sequence. What would be the best way to search through a give folder path? FileSearch object? I would appreciate some advice. Thanks, Matthew Pfluger |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Matthew
If I have inderstand your question : I use this procédure for stock files in memory. Since I work in memry for find the maxumum number Function MSOStockerFichiers(Chemin As String) As Integer '_Stocker les fichiers d'un dossier ' Résultat = nombre de fichier trouvés dans le dossier '- MSOStockerFichiers = 0 Set MonFSO = CreateObject("Scripting.FileSystemObject") Erase TZ5_Fichier TZ5_nb = 0 If MonFSO.FolderExists(Chemin) = False Then GoTo E1 For Each ForObject In MonFSO.GetFolder(Chemin).Files With ForObject TZ5_nb = TZ5_nb + 1 TZ5_Fichier(TZ5_nb) = .Name End With Next MSOStockerFichiers = TZ5_nb FP: Exit Function '= E1: MsgBox "Dossier non trouvé " & Chemin: GoTo FP End Function J a c q u e s "Matthew Pfluger" a écrit dans le message de ... I want to save several files with a naming convention as follows: "FilePrefix_###.xls", where the ### would be a number ranging from 1 to 999. The routine would search through a folder and determine if there were any other files named "FilePrefix_" and choose the next number in the sequence. What would be the best way to search through a give folder path? FileSearch object? I would appreciate some advice. Thanks, Matthew Pfluger |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jacques,
Thank you for your help. This will be a great starting point! Matthew Pfluger "Jacques ALARDET" wrote: Hello Matthew If I have inderstand your question : I use this procédure for stock files in memory. Since I work in memry for find the maxumum number Function MSOStockerFichiers(Chemin As String) As Integer '_Stocker les fichiers d'un dossier ' Résultat = nombre de fichier trouvés dans le dossier '- MSOStockerFichiers = 0 Set MonFSO = CreateObject("Scripting.FileSystemObject") Erase TZ5_Fichier TZ5_nb = 0 If MonFSO.FolderExists(Chemin) = False Then GoTo E1 For Each ForObject In MonFSO.GetFolder(Chemin).Files With ForObject TZ5_nb = TZ5_nb + 1 TZ5_Fichier(TZ5_nb) = .Name End With Next MSOStockerFichiers = TZ5_nb FP: Exit Function '= E1: MsgBox "Dossier non trouvé " & Chemin: GoTo FP End Function J a c q u e s "Matthew Pfluger" a écrit dans le message de ... I want to save several files with a naming convention as follows: "FilePrefix_###.xls", where the ### would be a number ranging from 1 to 999. The routine would search through a folder and determine if there were any other files named "FilePrefix_" and choose the next number in the sequence. What would be the best way to search through a give folder path? FileSearch object? I would appreciate some advice. Thanks, Matthew Pfluger |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto Increment Number | Excel Discussion (Misc queries) | |||
suspend auto increment | Excel Discussion (Misc queries) | |||
Paste value and Auto row increment | Excel Programming | |||
auto increment | Excel Discussion (Misc queries) | |||
DP Auto increment | Excel Worksheet Functions |