PC Review


Reply
Thread Tools Rate Thread

Auto-increment file name

 
 
Matthew Pfluger
Guest
Posts: n/a
 
      6th May 2008
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 With Quote
 
 
 
 
Jacques ALARDET
Guest
Posts: n/a
 
      6th May 2008
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" <(E-Mail Removed)> a écrit dans le
message de news:B76D7AFF-451A-4BE6-81BF-(E-Mail Removed)...
>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 With Quote
 
Matthew Pfluger
Guest
Posts: n/a
 
      6th May 2008
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" <(E-Mail Removed)> a écrit dans le
> message de news:B76D7AFF-451A-4BE6-81BF-(E-Mail Removed)...
> >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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: auto increment help please? June7 Microsoft Access Database Table Design 0 10th May 2009 04:42 AM
Auto increment file name =?Utf-8?B?S2VuIEcu?= Windows XP General 1 12th Feb 2007 06:39 PM
How do I auto increment a file No. for diff category ID's =?Utf-8?B?RmlzaGVybWFu?= Microsoft Access 2 25th Oct 2006 09:54 PM
DP Auto increment Waikato300zxClub@gmail.com Microsoft Excel Worksheet Functions 2 16th Aug 2006 12:37 AM
get the next auto increment Grant Microsoft ADO .NET 2 8th Jun 2004 09:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:38 PM.