Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Auto-increment file name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Auto-increment file name

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Auto-increment file name

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Increment Number Thomas [PBD] Excel Discussion (Misc queries) 0 June 24th 08 10:01 PM
suspend auto increment Bill Johnson Excel Discussion (Misc queries) 6 February 8th 08 06:26 PM
Paste value and Auto row increment AN Excel Programming 1 November 22nd 07 12:10 PM
auto increment Trizzle Excel Discussion (Misc queries) 1 December 6th 06 09:14 PM
DP Auto increment [email protected] Excel Worksheet Functions 2 August 16th 06 12:37 AM


All times are GMT +1. The time now is 02:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"